=================================================================== RCS file: /cvs/mp3/daemon/playmp3s.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mp3/daemon/playmp3s.pl 2006/08/12 01:28:56 1.3 +++ mp3/daemon/playmp3s.pl 2007/02/08 17:54:38 1.4 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $RedRiver: playmp3s.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $ +# $RedRiver: playmp3s.pl,v 1.3 2006/08/12 00:28:56 andrew Exp $ ######################################################################## # PlayMP3.pl *** play's MP3s off a playlist using mp3play # @@ -13,16 +13,13 @@ use vars qw/ %cfgs /; -#use strict qw/ $cfgs{list} @playlist $cfgs{mp3play} $filename $cfgs{basedir} $cfgs{htmldir} /; -#use diagnostics; - my $config_file = shift || "/etc/playmp3s.conf"; my %cfgs = readconfig($config_file); my $err_log = $cfgs{errors} || "/var/log/playmp3s.log"; - + Print_PlayLog("Beginning playtime\n\n"); my %Full_Playlist; @@ -66,7 +63,7 @@ Print_PlayLog("\tGot $song - filename is\n\t$filename\n"); Print_PlayLog("displaying file that is playing . . . "); - DisplayPlaying($cfgs{htmldir},$filename); + DisplayPlaying($cfgs{playedhtml},$filename); Print_PlayLog("done\n"); if ($save_playlist) { @@ -100,12 +97,12 @@ Print_PlayLog("Adding Last. . ."); delete ${ $Full_Playlist{list} }{$song}; - AddLast($filename, $cfgs{playedlist}, $cfgs{numhistory}, $cfgs{htmldir}, $cfgs{addurl}); + AddLast($filename, $cfgs{playedlist}, $cfgs{numhistory}, $cfgs{playedhtml}, $cfgs{addurl}); Print_PlayLog("done\n"); } Print_PlayLog("Displaying Nothing . . ."); - DisplayPlaying($cfgs{htmldir},"Nothing"); + DisplayPlaying($cfgs{playedhtml},"Nothing"); Print_PlayLog("done\n"); #@playlist = (); @@ -226,10 +223,10 @@ # Prints a webpage with the currently playing song sub DisplayPlaying { - my $htmldir = shift; - my $playing = shift; + my $htmlfile = shift; + my $playing = shift; - open BLANK, ">$htmldir/current.htm" or bail("Unable to open current.htm: $!"); + open BLANK, ">$htmlfile" or bail("Unable to open $htmlfile: $!"); print BLANK "\n\n\t' . $playing . '\n"; print BLANK "\n"; print BLANK "\n"; @@ -253,19 +250,19 @@ ####################################################################### # Prints a webpage with the previously played song -# AddLast($filename, $cfgs{playedlist}, $cfgs{numhistory}, $cfgs{htmldir}, $cfgs{addurl}); +# AddLast($filename, $cfgs{playedlist}, $cfgs{numhistory}, $cfgs{playedhtml}, $cfgs{addurl}); sub AddLast { my $lastsong = shift; my $lastlist = shift; - my $history = shift; - my $htmldir = shift; - my $addurl = shift; + my $history = shift; + my $htmlfile = shift; + my $addurl = shift; my @LIST = get_playlist($lastlist); unshift @LIST, $lastsong; splice (@LIST, $history); save_playlist($lastlist,@LIST); - DisplayPrevious($htmldir, $addurl, @LIST); + DisplayPrevious($htmlfile, $addurl, @LIST); } @@ -275,11 +272,11 @@ # Prints a webpage with the previously played song sub DisplayPrevious { - my $htmldir = shift; - my $addurl = shift; + my $htmlfile = shift; + my $addurl = shift; my $lastplay = shift; - my @played = @_; - open BLANK, ">$htmldir/played.htm" or bail("Unable to open $htmldir/played.htm: $!"); + my @played = @_; + open BLANK, ">$htmlfile" or bail("Unable to open $htmlfile: $!"); print BLANK "\n\n\t' . $lastplay . '\n"; print BLANK "\n"; print BLANK "\n";