Evening | Mon Feb 10 12:09:48 2003 |
| All programs... | |
| Topics: Programming | |
|
evolve to the point where they can read mail. mp3deep is on its way. I'm also thinking about making some utilities to clean some of the brain-damage present in redhat8.. or have I talked about that already? I don't remember. Finally, I'm playing with writing a simulator to play with some concepts in game theory. I don't really know as much about game theory as people who have studied it seriously, but in some ways that might actually make it more fun. Kind of strange how that works... I've also been thinking about picking up some long-neglected programming projects that I lost interest in some time ago. No, not MoLD (for now), but once I was working on a program that would attempt to generate ocean sounds and rain. Speaking of which, I once wrote a toy script that, with proper cron entries, would chime like a grandfather clock, and I spent about an hour on the net just listening to hundreds (thousands?) of chimes until I found just the right one. I should probably dig that sound out (I hope I didn't lose it). For those of you who like philosophy, this entry is pretty geeky, I guess. For those of you who like geeky stuff, this is probably a welcome break from the usual faire. If you're just interested in what I'm up to, *shrug*
Recursively, randomly play mp3s under current dir with mpg123 @default_options = ('-z'); $mutex_options{'-Z'} = '-z'; # What kind of random $mutex_options{'-0'} = '-1'; # Channel selector $mutex_options{'-2'} = '-4'; # Downsampling options @options_disallow = ('-w','-@','-u','-p','-h','-d','-o','-a','-g','-r','-f','-n','-k','-b'); # These all take arguments after them, and make it harder to
# do magic spiffy mutex checking.
cleanup_predef();
main(@ARGV); sub main { # eventually accept arguments for mpg123, for now, ignore args my @program_args = @_; my @args = figure_args(@program_args); print "Figured args LINK\n"; my @mp3_list = recurse_get_mp3list("."); do_mpg123(\@args, @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 =~ /\.mpLINK$/i))
{
push(@mp3files, $entry);
next;
}
}
return @mp3files;
}
sub do_mpg123 { my $argsref = shift; my @mp3s = @_; exec 'mpg123', @$argsref, @mp3s; } sub figure_args { # Coalesce @argv and @default_options into a coherent # set of args, using %mutex_argsmy @argv = @_; my %h_returner; foreach $arg (@argv, @default_options)
{
if($disallow{$arg})
{die "Disallowed argument LINK found\n";}
if(! (($mutex_options{$arg}) && ($h_returner{$mutex_options{$arg}})))
{$h_returner{$arg} = 1;}
}
return (keys %h_returner);
}
sub cleanup_predef { # It'd suck to need to specify mutually exclusive flags both ways map{$mutex_options{$mutex_options{$_}} = $_;} keys %mutex_options; map{$disallow{$_}=1;} @options_disallow; } | |