sub ices_init { print "##############Инициализация###############:\n"; $jingle = 0; $num_pls = 0; @list = `/bin/cat /home/24vmf/24vmf/www/playlist.pls`; $list1 = `/bin/cat /home/24vmf/24vmf/www/playlist.pls`; return 1; } sub ices_shutdown { print "Perl subsystem shutting down:\n"; } sub ices_get_next { if(`/bin/cat /home/24vmf/24vmf/www/playlist.pls`){ print "#############Есть плейлист###############:\n"; if($list1 eq `/bin/cat /home/24vmf/24vmf/www/playlist.pls`){ print "плейлист тотже самый:\n"; if($num_pls < `/bin/cat /home/24vmf/24vmf/www/playlist.pls | /usr/bin/wc -l`){ print "плейлист не закончился:\n"; $playlist=1; }else{ print "плейлист закончился:\n"; $playlist=0; #$num_pls=0; } }else{ print "#############плейлист обновился#############:\n"; @list = `/bin/cat /home/24vmf/24vmf/www/playlist.pls`; $list1 = `/bin/cat /home/24vmf/24vmf/www/playlist.pls`; $num_pls=0; $playlist=1; } }else{ print "##############плейлист не найден#############:\n"; $playlist=0; } if($playlist == 1){ $num_pls1=int($num_pls); chomp $list[$num_pls1]; $num_pls ++; return $list[$num_pls1]; }else{ print "##############не играю плейлист############:\n"; # if($jingle < 5){ # $jingle ++; @music=`/usr/bin/find /home/24vmf/24vmf/music/ -name *.mp3`; # }else{ # $jingle = 0; # @music=`/bin/ls -1 /home/24vmf/music/jingles/*.mp3`; # } $num = scalar(@music); $play=int(rand($num)); chomp $music[$play]; return $music[$play]; } } return 1; sub ices_get_metadata { use MP3::Info; if($playlist == 1){ $tag = get_mp3tag($list[$num_pls1]) or die "No TAG info"; return "$tag->{ARTIST}-$tag->{TITLE}-VMF24 "; }else{ $tag = get_mp3tag($music[$play]) or die "No TAG info"; return "$tag->{ARTIST}-$tag->{TITLE}-VMF24 "; } } sub ices_get_lineno { return 1; }