Menu

#4 Error in splitting playlist entries

open
nobody
None
5
2008-11-14
2008-11-14
Anonymous
No

In the subroutines parse_m3u_playlist and parse_pls_playlist the following line is wrong:
my (@lines) = split('\n', $playlist);

If the server, requested for a playlist, responds with a playlist with entries separated with LineFeed+NewLine (\r\n) this split will leave the LineFeed character (\r) at the end of the playlist entries. This will in turn cause parsing of the playlist entry in subroutine split_url to fail at the following line:
if ($url =~ /^([\d\w\._\-]+)(:\d+)??(\/.*)??$/)

Solution:
Change the lines with the split command in the subroutines parse_m3u_playlist and parse_pls_playlist to the following line:
my (@lines) = split(/[\r\n]+/, $playlist);

//Per Henriksson

Discussion


Log in to post a comment.

MongoDB Logo MongoDB