| 1 | package IPTV::Playlist::M3UTools; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.2.0'; | |||||||||||||||||||||||||||
| 8 | 1 | our @EXPORT_OK = qw(metadata playlist_url tool_url); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | my %TOOLS = ( | |||||||||||||||||||||||||||
| 11 | checker => '/iptv-checker', | ||||||||||||||||||||||||||||
| 12 | analyzer => '/m3u-playlist-analyzer', | ||||||||||||||||||||||||||||
| 13 | viewer => '/m3u-viewer', | ||||||||||||||||||||||||||||
| 14 | guides => '/guides', | ||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | sub playlist_url { | ||||||||||||||||||||||||||
|
Subroutine
playlist_url: called CC=4 SCAR=14.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 1 | my ($country) = @_; | |||||||||||||||||||||||||||
| 19 | 1 | ▶ | die 'value must be a non-empty string' if !defined($country) || ref($country); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $country or ref $country
MC/DC0%0/2
not defined $country or ref $country
not defined $country
ref $country
Truth table33%1/3
not(A) or B
A= not defined $countryB= ref $country
| |||||||||||||||||||||||||||||
| 20 | 1 | my $slug = lc $country; | |||||||||||||||||||||||||||
| 21 | 1 | $slug =~ s/[^a-z0-9]+/-/g; | |||||||||||||||||||||||||||
| 22 | 1 | $slug =~ s/^-+|-+$//g; | |||||||||||||||||||||||||||
| 23 | 1 | ▶ | die 'value must be a non-empty string' if $slug eq ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 1 | return "https://iptvplaylist.app/playlists/$slug"; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 5 | ▶ | sub tool_url { | ||||||||||||||||||||||||||
|
Subroutine
tool_url: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 5 | my ($tool) = @_; | |||||||||||||||||||||||||||
| 29 | 5 | ▶ | die 'tool must be a supported string' if !defined($tool) || ref($tool); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $tool or ref $tool
MC/DC0%0/2
not defined $tool or ref $tool
not defined $tool
ref $tool
Truth table33%1/3
not(A) or B
A= not defined $toolB= ref $tool
| |||||||||||||||||||||||||||||
| 30 | 5 | $tool = lc $tool; | |||||||||||||||||||||||||||
| 31 | 5 | $tool =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||
| 32 | 5 | ▶ | die 'tool must be checker, analyzer, viewer, or guides' if !exists $TOOLS{$tool}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 5 | return 'https://iptvplaylist.app' . $TOOLS{$tool}; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 1 | ▶ | sub metadata { | ||||||||||||||||||||||||||
|
Subroutine
metadata: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | return { | ||||||||||||||||||||||||||||
| 38 | 1 | name => 'IPTV Playlist', | |||||||||||||||||||||||||||
| 39 | homepage => 'https://iptvplaylist.app/', | ||||||||||||||||||||||||||||
| 40 | description => 'Public IPTV playlist directory and M3U utility site.', | ||||||||||||||||||||||||||||
| 41 | canonicalPages => { | ||||||||||||||||||||||||||||
| 42 | home => 'https://iptvplaylist.app/', | ||||||||||||||||||||||||||||
| 43 | playlists => 'https://iptvplaylist.app/playlists', | ||||||||||||||||||||||||||||
| 44 | checker => tool_url('checker'), | ||||||||||||||||||||||||||||
| 45 | analyzer => tool_url('analyzer'), | ||||||||||||||||||||||||||||
| 46 | viewer => tool_url('viewer'), | ||||||||||||||||||||||||||||
| 47 | guides => tool_url('guides'), | ||||||||||||||||||||||||||||
| 48 | }, | ||||||||||||||||||||||||||||
| 49 | tags => [qw(iptv m3u playlist)], | ||||||||||||||||||||||||||||
| 50 | }; | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 1 | 1; | |||||||||||||||||||||||||||