This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
mp3play [2006/11/13 13:22] 206.161.205.190 |
mp3play [2006/11/13 14:32] (current) andi old revision restored |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== play .m3u playlists via http ====== | ||
+ | |||
+ | All my mp3s are stored on my filesever. Normally I just mount the mp3 directory on my current workstation (either via NFS or Samba). I have some playlists too which store all files with relative paths (relative to the playlist location). This works fine. | ||
+ | |||
+ | But sometimes I want to have an easy way to listen to a playlist without mounting anything (eg. when using the laptop). So I made the mp3 files and playlists available on my local Apache webserver and use the following short CGI to get a playlist with http adresses to the file. | ||
+ | |||
+ | <code perl> | ||
+ | # | ||
+ | |||
+ | $WEBDIR = '/ | ||
+ | $WEBSERVER = ' | ||
+ | |||
+ | use CGI; | ||
+ | use File:: | ||
+ | |||
+ | print " | ||
+ | |||
+ | $q = new CGI(); | ||
+ | |||
+ | $list = $q-> | ||
+ | $dir = dirname($list); | ||
+ | $list = $WEBDIR.'/' | ||
+ | |||
+ | open (LIST, $list) or die(" | ||
+ | @m3u = < | ||
+ | close LIST; | ||
+ | |||
+ | foreach $file (@m3u){ | ||
+ | $file = ' | ||
+ | | ||
+ | print " | ||
+ | } | ||
+ | </ | ||