HomePage RecentChanges Contattami Random Page Le mie foto Il mio Blog RSS feed

playshuff.pl


#!/usr/bin/perl

# use CTRL+C to stop

use List::Util qw(shuffle);
use strict;
use warnings;

@ARGV or die "Use: $0 <filelist>\n" ;

my @PLAYER = ('/usr/bin/mplayer', '-vo', 'alsa');

open IN , "<$ARGV[0]" || die "Cannot open $ARGV[0] - $!\n";
my @files = <IN>;
close IN ;

@files = shuffle @files;

foreach my $song (@files) {
        chomp($song);
        if( -r $song and -f $song ) {
                system( @PLAYER , $song );
        }
}