sub ices_shutdown { print "Perl subsystem shutting down:\n"; } sub ices_get_next { print "Perl subsystem quering for new track:\n"; if($jingle < 5){ $jingle ++; @music=`/bin/ls -1 /var/music/*.mp3`; }else{ $jingle = 0; @music=`/bin/ls -1 /var/jingles/*.mp3`; } $num = scalar (@music); $play=int(rand($num)); chomp $music[$play]; return $music[$play]; } return 1;
sub ices_init { print "Perl subsystem Initializing:\n"; $jingle = 0; return 1; } sub ices_shutdown { print "Perl subsystem shutting down:\n"; } sub ices_get_next { print "Perl subsystem quering for new track:\n"; if($jingle < 5){ $jingle ++; @music=`/bin/ls -1 /var/my_sound/*.mp3`; }else{ $jingle = 0; @music=`/bin/ls -1 /var/jingles/*.mp3`; } $num = scalar (@music); $play=int(rand($num)); chomp $music[$play]; return $music[$play]; } sub ices_get_metadata { use MP3::Info; $tag = get_mp3tag($music[$play]) or die "No TAG info"; return "$tag->{ARTIST} - $tag->{TITLE}"; } return 1;
<Playlist> <File>/var/my_sound/playlist.txt</File> <Randomize>1</Randomize> <Type>perl</Type> <Module>my_sound</Module> <Crossfade>3</Crossfade> </Playlist>