You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use lib 'lib';
|
|
|
|
|
|
|
|
use POSIX qw(tmpnam);
|
|
|
|
use Test::More tests => 4;
|
|
|
|
|
|
|
|
require_ok('Text::Playlist::PLS');
|
|
|
|
|
|
|
|
my $pls = new_ok('Text::Playlist::PLS' => []);
|
|
|
|
|
|
|
|
my $path = tmpnam();
|
|
|
|
open my $FH, ">", $path;
|
|
|
|
print $FH <<EOF;
|
|
|
|
[playlist]
|
|
|
|
numberofentries=1
|
|
|
|
File1 = http://1.2.3.4:8000/listen.aac
|
|
|
|
Title1=(#1 - 1/1) Radio Broadcast
|
|
|
|
Length1=-1
|
|
|
|
Version=2
|
|
|
|
EOF
|
|
|
|
close $FH;
|
|
|
|
|
|
|
|
my $out = [{
|
|
|
|
file => 'http://1.2.3.4:8000/listen.aac',
|
|
|
|
title => '(#1 - 1/1) Radio Broadcast',
|
|
|
|
length => '-1',
|
|
|
|
}];
|
|
|
|
is_deeply(scalar $pls->load($path), $out, "Loading test playlist");
|
|
|
|
|
|
|
|
unlink $path;
|
|
|
|
|
|
|
|
my $text = <<PLS;
|
|
|
|
[playlist]
|
|
|
|
numberofentries=1
|
|
|
|
File1=http://1.2.3.4:8000/listen.aac
|
|
|
|
Title1=(#1 - 1/1) Radio Broadcast
|
|
|
|
Length1=-1
|
|
|
|
Version=2
|
|
|
|
PLS
|
|
|
|
|
|
|
|
is($pls->dump, $text);
|
|
|
|
|
|
|
|
exit 0;
|