use File::stat;
use Time::localtime;
+# Early command line options processing
+getopts("rh:tvs:");
+my $srcpathname = $opt_s;
+
####################################################################################################
# Configuration parameters - CHANGE THESE TO SUITE YOUR NEEDS
my $compute_host = "pippin.pippins.net"; # I need this since this script is run from a virtual machine
my $find_cmd = "find \"$srcpathname/\" -cmin $minage -iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\"";
####################################################################################################
-# Command line options
-getopts("rh:tvs:");
-
sub usage {
print "usage: $0 [-tvrh] -s <srcpath>\n";
print " -s <srcpath> specify the path to search for videos to merge under\n";
print " -r remove merged video clips; after a merge, remove the individual video files that were merged\n";
return 1;
}
-my $srcpathname = $opt_s;
if(defined $opt_h) { usage(); exit 1; }
# Sanity checks
}
$dstfile = "$newfile.$ext";
- print " merging \"$srcdir/$srcfile\" into \"$dstfile\"\n";
push(@{$videos{"$dstfile"}}, "\"$srcdir/$srcfile\"");
}
+# Tell the user which videos we are going to merge
+foreach $video (sort keys %videos) {
+ # Only merge the videos if there is more than 1
+ my $num_videos = $#{$videos{$video}} + 1;
+ if($num_videos <= 1) { next; }
+
+ foreach $srcfile (@{$videos{$video}}) {
+ print " merging \"$srcfile\" into \"$video\"\n";
+ }
+}
+
+# Now actually do the merging
foreach $video (sort keys %videos) {
my $videos = join(',', @{$videos{$video}});