Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Created May 30, 2011 19:54
Show Gist options
  • Save pesterhazy/999384 to your computer and use it in GitHub Desktop.
Save pesterhazy/999384 to your computer and use it in GitHub Desktop.
--- tmp/flashcache 2011-03-14 03:49:35.000000000 +0100
+++ bin/flashcache 2011-04-29 19:39:37.000000000 +0200
@@ -57,6 +57,7 @@
while (my $arg=shift(@ARGV)) {
if ($arg =~ /^-h$/) { usage(); }
if ($arg =~ /^-d$/) { $MAIN::DEBUG=1; next; }
+ if ($arg =~ /^-p$/) { $MAIN::PLAY=1; next; }
if ($arg =~ /^-find$/) { $opt->{find} = shift(@ARGV); next; }
if ($arg =~ /^-post$/) { $opt->{post} = shift(@ARGV); next; }
if ($arg =~ /^-dest$/) { $opt->{dest} = shift(@ARGV); next; }
@@ -129,11 +130,20 @@
my $opt = parseArgs();
my @found = findFiles($opt);
- foreach my $found ( @found ) {
- my $src = procPath(@$found);
- my $dest = destPath($opt);
- print "$src -> $dest\n";
- system("/bin/cp",$src,$dest);
- }
+ if ($MAIN::PLAY) {
+ my @paths;
+ foreach my $found ( @found ) {
+ my $src = procPath(@$found);
+ push @paths, $src;
+ }
+ system("mplayer", "-fs", @paths);
+ } else {
+ foreach my $found ( @found ) {
+ my $src = procPath(@$found);
+ my $dest = destPath($opt);
+ print "$src -> $dest\n";
+ system("/bin/cp",$src,$dest);
+ }
+ }
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment