Pat Gunn (dachte) wrote,
Pat Gunn
dachte

mp3deep

  1. !/usr/bin/perl -w

    Recursively, randomly play mp3s under current dir with mpg123

main();

sub main{ # eventually accept arguments for mpg123, for now, ignore args@mp3_list = recurse_get_mp3list(".");do_mpg123(@mp3_list);}

sub recurse_get_mp3list{my $cwd = shift;opendir(THISDIR, $cwd);my @mp3files;my @direntries = map {$cwd . '/' . $_;} grep !/^\./, readdir(THISDIR);closedir(THISDIR);foreach my $entry (@direntries)
{
if( -d $entry)
{
push(@mp3files, recurse_get_mp3list($entry));
next;
}
if( ( -f $entry) && ($entry =~ /\.LINKLINKLINK$/))
{
push(@mp3files, $entry);
next;
}
}
return @mp3files;}

sub do_mpg123{my @mp3s = @_;

  1. print "Asked to play: " . join(' ', @mp3s) . "\n";
$cmd = 'mpg123 -z ' . join ' ', (map {"\"$_\"" ;} @mp3s);print "Try LINK\n";exec $cmd;}
Tags: programming
Subscribe

  • Still alive

    Been feeling a bit nostalgic. Not about to return to LiveJournal - their new ownership is unfortunate, but I wanted to briefly note what's been up…

  • Unplugging LJ

    It's about time I pulled the plug on the LJ version of my blog: 1) I'm much more active on G+ than I am with general blogging. I post many times a…

  • Mutual Trust

    I don't know which should be considered more remarkable: That a cat should trust a member of a far larger and stronger species that it can't…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments