LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   A Program/script making a html playlist? (https://www.linuxquestions.org/questions/linux-software-2/a-program-script-making-a-html-playlist-169796/)

Trinity22 04-13-2004 08:19 PM

A Program/script making a html playlist?
 
My .m3u file is littered with tags like
Quote:

#EXTINF:-1,Skinny Puppy - Candle
/home/trinity/Music/Skinny Puppy - Candle.mp3
#EXTINF:-1,Skinny Puppy - Inquistion
/home/trinity/Music/Skinny Puppy - Inquistion.mp3
#EXTINF:-1,Skinny Puppy - Tormentor (Time 4.32)
/home/trinity/Music/Skinny Puppy - Tormentor (Time 4.32).mp3
#EXTINF:-1,Techno - VNV Nation - Futureperfect - Beloved
/home/trinity/Music/Techno - VNV Nation - Futureperfect - Beloved.mp3
#EXTINF:-1,The Cruxshadows - Bloodline
/home/trinity/Music/The Cruxshadows - Bloodline.mp3
so I need a program or something that can make an html playlist for my site based upon what I use in XMMS or something....... I'd be greatful for any suggestion. I've got a friend on aim who doesn't know how to do it either and he knows more about linux than I.

Thanks,
Trinity

95se 04-13-2004 08:25 PM

What do you mean exactly? You want to have links to the mp3s? Or you want to have it run on your computer when you click on it?

Trinity22 04-13-2004 08:29 PM

Just a text file showing something like
Quote:

Blahblah - The blah song.mp3
Second Band - Secondsong.mp3
Third Group - Thirdsong.mp3
So I can show what my playlist is on my site. Nothing with links or need to download.

Trinity

Komakino 04-13-2004 08:58 PM

Code:

#!/usr/bin/perl

`echo '<HTML><BODY bgcolor=black text=white>' >> playlist.html`;
`echo '<center><h1><u><b>XMMS Playlist</b></u></h1></center>' >> playlist.html`;

foreach $file (`ls /music -R *.mp3`){
        if( $file =~ /mp3$/i ){
    `echo \"$file <br>\" >> playlist.html`;
        }
}

`echo '</BODY></HTML>' >> playlist.html`;

This is a VERY simple perl script. Pretty crude too, but it does the job. This will search your hard disk, starting at the directory /music (change this to your parent music directory) and will output an HTML page called playlist.html with just a title and then every filename listed underneath.

Copy and paste my code into a text file, save it, then do:
chmod +x filename
perl ./filename
to run it. Obviously you need perl installed.
Warning though, if you run this twice it will list all the songs twice, so if you need to run it again, delete the playlist.html file.

Oh yeah, if all your mp3s are in one folder then you can delete the -R from the 'foreach' line, and have the /music bit as your folder.

Trinity22 04-13-2004 09:29 PM

very, very cool, Komakino :) Thanks for the script. It works great.

Trinity


All times are GMT -5. The time now is 11:28 AM.