From: Alan Pippin <apippin@pippins.net>
Date: Mon, 24 Sep 2012 06:02:28 +0000 (-0600)
Subject: Fixed some bugs found in re-testing
X-Git-Url: http://git.pippins.net/%27%20.%20%24this-%3Ephpgw_js_url%20.%20%27/jscalendar/checkmark.gif?a=commitdiff_plain;h=70d3ba3c710f3fe234188d492b42338aa2069513;p=videoscripts%2F.git

Fixed some bugs found in re-testing
---

diff --git a/merge_videos_by_day b/merge_videos_by_day
index 6dce13c..4cf293d 100755
--- a/merge_videos_by_day
+++ b/merge_videos_by_day
@@ -282,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");
 		}
 	    }
 	}
diff --git a/organize_videos b/organize_videos
index 4e1ad7f..5625f8b 100755
--- a/organize_videos
+++ b/organize_videos
@@ -197,7 +197,7 @@ foreach $file (`$find_cmd_with_mkv`) {
 
     # We are ready to pick a destination folder to put the video in
     $dstdir = $dstpathname . "/" . $year;
-    $dstdirs[$dstdir] = 1;
+    $dstdirs{$dstdir} = 1;
     $dstfile = $dstdir . "/" . $year . "-" . $monthnum . "-" . $day;
 
     # Check for duplicate filenames at the destination