Browse Source

* skip leading spaces before title in m3u playlist

master 0.02
Alex 'AdUser' Z 10 years ago
parent
commit
bed3dea90f
  1. 2
      lib/Text/Playlist/M3U.pm
  2. 3
      t/m3u.t

2
lib/Text/Playlist/M3U.pm

@ -32,7 +32,7 @@ sub parse {
$self->{attrs} = $self->_parse_attrs($1); $self->{attrs} = $self->_parse_attrs($1);
} }
# standart tags # standart tags
if ($line =~ m/^\s*#EXTINF:(-?\d+(?:\.\d+)?)(\s+\S+?=\S+)*,(.*)/oi) { if ($line =~ m/^\s*#EXTINF:(-?\d+(?:\.\d+)?)(\s+\S+?=\S+)*,\s*(.*)/oi) {
$item //= { $item //= {
duration => $1, duration => $1,
attrs => $self->_parse_attrs($2), attrs => $self->_parse_attrs($2),

3
t/m3u.t

@ -15,7 +15,7 @@ my $text = <<M3U;
#EXTM3U aspect-ratio=4:3 #EXTM3U aspect-ratio=4:3
#EXTINF:-1,First channel #EXTINF:-1,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
M3U M3U
@ -40,6 +40,7 @@ my @items = $pls->load($path);
is_deeply(\@items, $out, "Loading test playlist"); is_deeply(\@items, $out, "Loading test playlist");
unlink $path; unlink $path;
$text =~ s/,\s+Second/,Second/o;
is($text, $pls->dump(@items)); is($text, $pls->dump(@items));
exit 0; exit 0;

Loading…
Cancel
Save