Look at these hands.. What can be built with them? No doubt many things that will not, but they won't sit idle.
Here's a shrine to Insomnia. I don't think I'll ever forget that place...
I also just merged two of my media player wrappers into a single script.. I was getting irritated because I'd modify one to add a feature, and then try to use it in the other.. they did much of the same thing, and one was forked from the other.. so let them merge. For your geekness enjoyment, here ya go. Oh, and if you don't know how to use this, it's probably not something that'd be useful to you anyhow. I call the program smartdeep, by the way.
wrapper for media players.
our %player = ( 'mp3' => 'mpg123', 'mp2' => 'mpg123', 'ogg' => 'ogg123', 'au' => 'killall esd;play', # killall makes sure esd 'wav' => 'killall esd;play', # has released snd device 'raw' => 'playraw'
Specify your fullscreen movie player here.
'rm' => 'fmplayer', 'mpeg' => 'fmplayer', 'mov' => 'fmplayer' );
Note: for me, fmplayer is a shell script: #!/bin/sh mplayer -rootwin -fs $*
And your partscreen movie player here.
'rm' => 'mplayer', 'mpeg' => 'mplayer', 'mov' => 'mplayer' ); main();
sub handle_args(@;) { my (@args) = @_; my %returner; my @flist; $returner{mode} = 'once'; $returner{shuf} = 0; $returner{class} = 'songs'; foreach my $arg (@args) { if($arg =~ /^-z$/) { $returner{mode} = 'once'; $returner{shuf} = 1; next; } if($arg =~ /^-Z$/) { $returner{mode} = 'loop'; $returner{shuf} = 1; next; } if($arg =~ /^-m$/) # fullscreen movie playing. {$returner{class} = 'movies';next;} if($arg =~ /^-M$/) # partscreen movie playing. {$returner{class} = 'Movies';next;} if($arg =~ /^-s$/) {$returner{class} = 'songs';next;} if($arg =~ /^--?h(:?elp)?$/i) {die "Usage: $0 -Z-M\n";} if((-d $arg) || (-f $arg)) {push(@flist, $arg);next;} warn "Unrecognized option LINK\n"; } if(scalar(@flist) == 0) { push(@flist, '.'); # no files = play deep hierarchy $returner{shuf} = 1; # Also, in this case, we probably want random. } return (\%returner, @flist); }
sub get_deeplist($@;) { my($prefs,@flist) = @_; my @dl; foreach my $fle (@flist) { if(-d $fle) { push(@dl, recurse_deeplist($$prefs{class}, $fle)); } else { push(@dl, $fle); } } return @dl; }
sub recurse_deeplist($$;) { my ($class, $path) = @_; my @interesting; opendir(HERE, $path); my @seen = grep !/^\./, # We don't want dotfiles, especially '.' and '..' readdir(HERE); closedir(HERE); foreach my $fn (@seen) { if(-d "$path/$fn") { push(@interesting,recurse_deeplist($class, "$path/$fn")); } else { my $t_ext = get_extension("$path/$fn"); if( (($class eq 'songs') && defined($player{$t_ext})) || (($class =~ /movies/i) && defined($movplayer{$t_ext})) ) { push(@interesting, "$path/$fn"); } else {
sub get_extension($;) { my ($tf) = @_; local $_; $tf =~ /.*\/.*\.(.*)$/; if(! defined($1)) {return '';} else {return lc($1);} }
sub play_file($$;) { my ($prefs, $file) = @_; my $mplayer; if($$prefs{class} eq 'songs') {$mplayer = $player{get_extension($file)}; } elsif($$prefs{class} =~ 'movies') { $mplayer = $movplayer{get_extension($file)}; } elsif($$prefs{class} eq 'Movies') { $mplayer = $wmovplayer{get_extension($file)}; }
print "Play $file with " . $mplayer . "\n"; system("$mplayer $file"); }
Does this remind you of a particular famous painting? This picture actually gives us more information on the painting.. it's not a creation, no, this time we can understand it as a peace treaty. There's even a mediator.