projects
/
videoscripts
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6868d6d
)
Bug fixes
author
Alan J. Pippin
<alan@pippins.net>
Fri, 18 Nov 2011 04:08:42 +0000
(21:08 -0700)
committer
Alan J. Pippin
<ajp@pippins.net>
Fri, 18 Nov 2011 04:08:42 +0000
(21:08 -0700)
merge_videos_by_day
patch
|
blob
|
history
diff --git
a/merge_videos_by_day
b/merge_videos_by_day
index 6d48bfc5dc6dc36ac43dfdd8abaa6c549cf63cb5..52164d4689824615a25c3a206f81528c926e8347 100755
(executable)
--- a/
merge_videos_by_day
+++ b/
merge_videos_by_day
@@
-8,6
+8,10
@@
use Getopt::Std;
use File::stat;
use Time::localtime;
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
####################################################################################################
# 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
@@
-22,9
+26,6
@@
my $video_title_prefix = "HomeVideos:"; # What text to put on the front of the t
my $find_cmd = "find \"$srcpathname/\" -cmin $minage -iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\"";
####################################################################################################
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";
sub usage {
print "usage: $0 [-tvrh] -s <srcpath>\n";
print " -s <srcpath> specify the path to search for videos to merge under\n";
@@
-34,7
+35,6
@@
sub usage {
print " -r remove merged video clips; after a merge, remove the individual video files that were merged\n";
return 1;
}
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
if(defined $opt_h) { usage(); exit 1; }
# Sanity checks
@@
-128,10
+128,21
@@
foreach $file (sort `$find_cmd`) {
}
$dstfile = "$newfile.$ext";
}
$dstfile = "$newfile.$ext";
- print " merging \"$srcdir/$srcfile\" into \"$dstfile\"\n";
push(@{$videos{"$dstfile"}}, "\"$srcdir/$srcfile\"");
}
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}});
foreach $video (sort keys %videos) {
my $videos = join(',', @{$videos{$video}});