X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=organize_videos;fp=organize_videos;h=86047a1a65fdc6785a771e7a86816d134512e12b;hb=32f5e50c17ae4efc216a50ef2cecae7e2dcf6508;hp=539c2c17fa47f068e3f73287b649029debaa7cd3;hpb=bceefcbd297683c9e15c33f945fcb99006f6030a;p=videoscripts%2F.git diff --git a/organize_videos b/organize_videos index 539c2c1..86047a1 100755 --- a/organize_videos +++ b/organize_videos @@ -14,13 +14,15 @@ use File::Pid; my $srcpathname = "/naspool/pictures/New Photos"; # Path to look for videos to move from my $dstpathname = "/naspool/videos/HomeVideos"; # Path to move the videos to my $merge_videos_by_day = "/naspool/videos/bin/merge_videos_by_day"; -my $minage = "+10"; # File creation dates must be older than X minutes to move +my $minage = "+30"; # Video file creation dates must not have changed in the last X minutes to process any of the video files 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 $playlist_extension = "pls"; # The extension to use when creating playlist files my $video_suffix = "000"; # What number to start with when adding an incrementing suffix to the end of the final video clip to avoid name collisions -my $find_cmd = "find \"$srcpathname/\" -cmin $minage -a \\( -iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\" -o -iregex \".*\.mkv\" \\)"; +my $movie_file_ext = "-iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\" -o -iregex \".*\.mkv\""; +my $find_changed_cmd = "find \"$srcpathname/\" -not -cmin $minage -a \\( $movie_file_ext \\)"; +my $find_cmd = "find \"$srcpathname/\" $movie_file_ext"; #################################################################################################### # Sanity check @@ -123,6 +125,10 @@ if(defined $opt_p) { $video_files_found=`$find_cmd`; if(!$video_files_found) { exit 0; } +# Only proceed if no files have changed in the past $cmin minutes +$changed_files_found=`$find_changed_cmd`; +if($changed_files_found) { exit 0; } + # Only one instance of this script running at a time my $pidfile = File::Pid->new({file => "/tmp/organize_videos.pid"}); exit if $pidfile->running();