From 26e29c4b2a1ba5181b379a64c86f4d521d77dcf7 Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Wed, 19 Jan 2022 14:47:19 -0700 Subject: [PATCH] Fixed a few bugs --- merge_videos_by_day | 8 ++++---- move_videos_from_watchdir | 6 ++++++ organize_videos.conf | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/merge_videos_by_day b/merge_videos_by_day index dd0d1ca..91070d8 100755 --- a/merge_videos_by_day +++ b/merge_videos_by_day @@ -92,10 +92,10 @@ foreach $file (sort `$find_cmd`) { if((! -f "$srcfile") && (! -f "$srcdir/$srcfile")) { next; } # Throw out encoded files left over from a previous run - print "srcfile: $srcfile\n"; + #print "srcfile: $srcfile\n" if($opt_v); if($srcfile =~ /.hb.mp4/) { next; } - print "Found movie: srcdir: $srcdir srcfile: $srcfile srcext: $srcext dstext: $ext\n" if($opt_v); + print "Found video: srcdir: $srcdir srcfile: $srcfile srcext: $srcext dstext: $ext\n" if($opt_v); # Make a note of the month, year, and day this video was taken (from the modification time of the file) $date_taken = ctime(stat("$srcdir/$srcfile")->mtime); @@ -193,7 +193,7 @@ foreach $dstfile (sort keys %videos) { } } else { # Create the merged video - print "$cmd" if($opt_v); + print "$cmd\n" if($opt_v); my $errno = system("$cmd"); $errno = $errno >> 8; if($errno) { die "-E- make_mkv encountered some errors with exit code $errno\n"; } @@ -202,7 +202,7 @@ foreach $dstfile (sort keys %videos) { # Fix the permissions system("chown $owner \"$dstfile\"*"); system("chgrp $group \"$dstfile\"*"); - system("chmod $mode \"$dstfile\"*"); + system("find \"$dstfile\"* -type f -exec chmod $mode -- {} +"); # Remove the individual video files if(!defined $opt_k) { diff --git a/move_videos_from_watchdir b/move_videos_from_watchdir index 83ec63f..364ade6 100755 --- a/move_videos_from_watchdir +++ b/move_videos_from_watchdir @@ -78,6 +78,12 @@ foreach $watchpath (split(';', $watchpathname)) { $srcfile = $file; $dstfile = "$dstpathname/$file"; + # Make sure srcdir is group writable + if(not -w "$srcdir") { + print "-W- srcdir is not group writable, can't move videos out of it: $srcdir\n"; + next; + } + # Make sure we have a unique dstfile if(-f "$dstfile") { $video_ext = $srcfile; diff --git a/organize_videos.conf b/organize_videos.conf index bac6fb4..ccc46e2 100644 --- a/organize_videos.conf +++ b/organize_videos.conf @@ -76,7 +76,7 @@ $no_recompress_file_ext = qr/\.(mp4)$/i; # Video file creation dates must not have changed in the last X minutes to process any of the video files # This is done to ensure that all videos from a given upload from a camera have completed prior to looking for videos to merge -$minage = "+30"; +$minage = "+60"; # What command should be used to find files that have changed (are at least $minage old) $find_changed_cmd = "find \"$srcpathname/\" -not -cmin $minage -a \\( $movie_file_ext \\)"; -- 2.34.1