#!/usr/local/bin/perl
# spielt zufällig mods aus part5/songs-mods ab
srand($$);
chomp($DEVICE=`get_audio_name`);
if($DEVICE eq "SUNW,am79c30") { $PLAYER="mikmod -t -m8f 8000 " }
if($DEVICE eq "SUNW,dbri") { $PLAYER="mikmod -t " }
if($DEVICE eq "SUNW,CS4231") { $PLAYER="mikmod -t " }
if($DEVICE eq "") { die "Kein Audio verfügbar (Remote login?)\n\n" }
chop($HOST=`hostname`);
if ($HOST eq "isun04") { $MODPATH="/local/part5/songs-mod" }
else { $MODPATH="/mount/part5/songs-mod" }
$MODS=`/bin/find $MODPATH -name readmes -prune -o -type f -print`;
$i=$COUNT=split(/\n/,$MODS);
print "$COUNT Mods gefunden. \n\n";
while ($i>1)
{
$r=int(rand($i)+1);
# print "[$i] $r";
$t=splice(@_,$r,1); if ($t eq "") { $t=pop(@_) }
# print "Now playing [$t]\n";
system("$PLAYER $t");
if ($? == 0) { exit(0) }
$i--;
}