Fixed some bugs found in re-testing
[videoscripts/.git] / merge_videos_by_day
index 4d96b93be7438260d6106c056831a9f01b247d4f..4cf293ddea47cbd2b699faf4febcaa0fbe22fff7 100755 (executable)
@@ -13,21 +13,13 @@ getopts("qkh: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 $use_compute_host = 1; # Set to 1 to use a remote compute host to run the mkvmerge command. Set to 0 to use the local host to run it.
-my $make_mkv = "/naspool/videos/bin/make_mkv"; # Update this to be the path to the make_mkv script
-my $requantize_input_video=1; # This will dramatically decrease the size of the video with minimal compute processing requirements.
-my $owner = "ajp"; # The owner of the files after they are moved
-my $group = "pip"; # The group of the files after they are moved
-my $mode = "664"; # The mode to set on each file after they are moved
-my $video_suffix = "000"; # What number to start with when adding an incrementing suffix to the end of the video clip to avoid name collisons
-my $video_title_prefix = "HomeVideos:"; # What text to put on the front of the title for the merged video being created
-my $find_cmd = "find \"$srcpathname/\" -iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\"";
-my $handbrake='HandBrakeCLI';
-my $handbrake_options='--strict-anamorphic --crop 0:0:0:0 -E ac3';
-my $interlaced_requantize_quality=0.85;
-my $progressive_requantize_quality=0.7;
+# Configuration parameters
+$mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir); unshift @INC,("$mydir");
+# Default configuration values
+require "organize_videos.conf";
+# Override defaults with local customizations
+if( -f "$mydir/organize_videos.conf.local") { require "organize_videos.conf.local"; }
+
 ####################################################################################################
 
 sub usage {
@@ -290,14 +282,15 @@ foreach $ext (sort keys %videos) {
            my $errno = system("$cmd");
            $errno = $errno >> 8;
            if($errno) { die "-E- make_mkv encountered some errors with exit code $errno\n"; }
+           system("ls -l \"$srcpathname/\" > /dev/null"); # Make sure the video file is there
            # Fix the permissions
            system("chown $owner \"$video\"");
            system("chgrp $group \"$video\"");
            system("chmod $mode \"$video\"");
            # Remove the individual video files
            if(!defined $opt_k) { 
-               foreach $video (@{$videos{$ext}{$video}}) {
-                   system("rm -f $video");
+               foreach $srcvideo (@{$videos{$ext}{$video}}) {
+                   system("rm -f $srcvideo");
                }
            }
        }