Added protection about only running the organizing/merging if video files haven't...
[videoscripts/.git] / make_mkv
index bfbaa11600041bd7c1636ffa020ae8f302f23f46..042e38eaca0eed66ede829b9c8f4a05f8ddaf0eb 100755 (executable)
--- a/make_mkv
+++ b/make_mkv
@@ -23,7 +23,7 @@ my $ffmpeg=`which ffmpeg`; chomp($ffmpeg);
 my $tmpfile = `tempfile`; chomp($tmpfile);
 my $chapter_file = $tmpfile;
 my $input_file_options = "-S";
-my $output_file_options = "--chapters $chapter_file";
+my $output_file_options = "--chapters $chapter_file --compression -1:none";
 my $timezone = `cat /etc/timezone`; chomp($timezone);
 ####################################################################################################
 
@@ -118,8 +118,11 @@ foreach my $video (sort{$videos{$a} <=> $videos{$b}} keys %videos) {
 print "$cmd\n";
 if(! defined $opt_s) { 
     my $errno = system("$cmd");
-    if($errno > 0) { $errno = $errno - 255; }
-    if($errno > 1) { die "-E- mkvmerge encountered some errors with exit code $errno\n"; }
+    $errno = $errno >> 8;
+    if($errno > 1) {
+       unlink "$opt_o";
+       die "-E- mkvmerge encountered some errors with exit code $errno\n";
+    }
 }
 
 # Remove the temporary file used for the chapter generation