#!/usr/bin/perl # This Perl script is adapted from the example script in the RSSLite package # There is no warranty, explicit or implied. Hack at your own risk. # The JavaScript, HTML and CSS is original and written by dan@inmyexperience.com # Suggestions on how to do any of this better are welcome. use LWP::Simple; use XML::RSSLite; my $content = get('http://127.0.0.1/audio?op=rdf') or die "Can't get the content!"; my %result; parseXML(\%result, \$content); open(OUT, ">/Library/WebServer/Documents/music.html"); print OUT < My MP3 collection HTML print OUT < HTML my $item; my $title = '0'; # my $mp3url; my $urlmd5; my $md5; # my $currentArtist; my $bgcolor; $mp3url = $item->{'link'}; $urlmd5 = index($mp3url, "song=") + 5; print OUT <
Playing Music: Click a track title to play that track in the browser (mpeg data will just start downloading)
Streaming: Select one or more tracks and go to the bottom, select a playlist format, and click Go!
All Artist Title Album Time Genre HTML foreach $item (@{$result{'items'}}) { $mp3url = $item->{'link'}; $urlmd5 = index($mp3url, "song=") + 5; $md5 = substr($mp3url, $urlmd5, $urlmd5 + 32); print OUT "\n", "{'audio:album'}\">\n", "$item->{'audio:artist'} \n", "$item->{'title'} \n", "{'audio:album'}'); return false;\">$item->{'audio:album'} \n", "$item->{'audio:comment'} \n", "$item->{'audio:genre'} \n", "<\/tr>\n\n"; } print OUT <     M3U (v1)   M3U (v2)   RDF         \n\n HTML