|
|
@ -5,21 +5,23 @@ use warnings; |
|
|
|
use lib 'lib'; |
|
|
|
use lib 'lib'; |
|
|
|
|
|
|
|
|
|
|
|
use POSIX qw(tmpnam); |
|
|
|
use POSIX qw(tmpnam); |
|
|
|
use Test::More tests => 3; |
|
|
|
use Test::More tests => 4; |
|
|
|
|
|
|
|
|
|
|
|
require_ok('Text::Playlist::M3U'); |
|
|
|
require_ok('Text::Playlist::M3U'); |
|
|
|
|
|
|
|
|
|
|
|
my $pls = new_ok('Text::Playlist::M3U' => []); |
|
|
|
my $pls = new_ok('Text::Playlist::M3U' => []); |
|
|
|
|
|
|
|
|
|
|
|
my $path = tmpnam(); |
|
|
|
my $text = <<M3U; |
|
|
|
open my $FH, ">", $path; |
|
|
|
|
|
|
|
print $FH <<EOF; |
|
|
|
|
|
|
|
#EXTM3U aspect-ratio=4:3 |
|
|
|
#EXTM3U aspect-ratio=4:3 |
|
|
|
#EXTINF:-1 cn-id=10338245,First channel |
|
|
|
#EXTINF:-1 cn-id=10338245,First channel |
|
|
|
http://127.0.0.1:1027/udp/224.3.22.7:1234 |
|
|
|
http://127.0.0.1:1027/udp/224.3.22.7:1234 |
|
|
|
#EXTINF:-1 cn-id=34727751,Second channel +8 |
|
|
|
#EXTINF:-1 cn-id=34727751,Second channel +8 |
|
|
|
http://127.0.0.1:1027/udp/224.3.23.9:1234 |
|
|
|
http://127.0.0.1:1027/udp/224.3.23.9:1234 |
|
|
|
EOF |
|
|
|
M3U |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $path = tmpnam(); |
|
|
|
|
|
|
|
open my $FH, ">", $path; |
|
|
|
|
|
|
|
print $FH $text; |
|
|
|
close $FH; |
|
|
|
close $FH; |
|
|
|
|
|
|
|
|
|
|
|
my $out = [{ |
|
|
|
my $out = [{ |
|
|
@ -37,4 +39,6 @@ my $out = [{ |
|
|
|
is_deeply(scalar $pls->load($path), $out, "Loading test playlist"); |
|
|
|
is_deeply(scalar $pls->load($path), $out, "Loading test playlist"); |
|
|
|
unlink $path; |
|
|
|
unlink $path; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is($text, $pls->dump); |
|
|
|
|
|
|
|
|
|
|
|
exit 0; |
|
|
|
exit 0; |
|
|
|