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

  • JS Ugliness

    I'm weirded out that standards for Javascript programming are so low. Having made a more-or-less a successful first project, where I really rushed…

  • Controversial Opinions in Programming

    I like that recently there's been a meme floating around, started by one good blog post that got a lot of airtime, of posting and then talking about…

  • Firefox and Clipboard-clobbering

    I often find that my PRIMARY clipboard (the one associated with mouse selections in the X Window System, not to be confused with the CLIPBOARD…

  • 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