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 $minage = "+10"; # Files must be older than X minutes to move
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/\" -cmin $minage -iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\"";
+my $find_cmd = "find \"$srcpathname/\" -iregex \".*\.mov\" -o -iregex \".*\.3gp\" -o -iregex \".*\.mp4\" -o -iregex \".*\.mts\"";
####################################################################################################
sub usage {
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
$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();