Added force option to organize_videos which ignores $minage
authorAlan J. Pippin <alan@pippins.net>
Sat, 15 Jul 2017 17:17:49 +0000 (11:17 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Sat, 15 Jul 2017 17:17:49 +0000 (11:17 -0600)
Updated path to movie directory
Fixed Original copying logic in organize_videos to avoid double date bug

homevideo_random.pl
make_mobile_movie
merge_videos_by_day
organize_movies
organize_videos

index 4e5a81a8f05b31888845eb367478d6effe06e785..23376b1d4f991138da808aaee63257e5bc54062f 100755 (executable)
@@ -4,11 +4,11 @@ use List::Util 'shuffle';
 
 my $dir = "/naspool/videos/HomeVideos";
 my $plsfile = "$dir/Random.pls";
-my $avifiles = "????/????-??-??.avi";
+my $mkvfiles = "????/*.mkv";
 
 chdir $dir || die "Couldn't change directory!\n";
 system "rm -f $plsfile";
-@files = `ls -1 $avifiles`;
+@files = `ls -1 $mkvfiles`;
 @shuffled = shuffle(@files);
 open (FILE, ">$plsfile") || die "Couldn't open $plsfile!\n";
 print FILE @shuffled;
index e4d2331ee844354053792d2f9f44ea1e58896902..53e293cb467b387d4837d730062258789c0ba7d9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 DROPBOX="/naspool/dropbox/New Movies"
-MOVIEDIR="/naspool/movies"
+MOVIEDIR="/movpool/movies"
 MOVIE="$1"
 CATEGORY="$2"
 
index 4a58f0fce3d398c5561402f573ff18c7e4f11ab8..7179746cea631fd16daf9072326a5947834bfaa1 100755 (executable)
@@ -211,7 +211,11 @@ foreach $ext (sort keys %videos) {
                foreach $video (@{$videos{$ext}{$video}}) {
                    if(($save_originals) && ($video =~ /\.$originals_file_ext/)) {
                        print "-> Saving the original video $video\n";
-                       print("mv $video \"$origpathname/".basename(dirname($video))."_".basename($video)."\n");
+                       if(index($video, basename(dirname($video))) == -1) { 
+                           print("mv $video \"$origpathname/".basename(dirname($video))."_".basename($video)."\n");
+                       } else {
+                           print("mv $video \"$origpathname/".basename($video)."\n");
+                       }
                    } else {
                        print "-> Removing the original video $video\n";
                        print("/bin/bash -c '[[ -e $video ]] && rm -f $video'\n");
@@ -233,7 +237,11 @@ foreach $ext (sort keys %videos) {
                foreach $srcvideo (@{$videos{$ext}{$video}}) {
                    if(($save_originals) && ($srcvideo =~ /\.$originals_file_ext/)) {
                        print "-> Saving the original video $srcvideo to $origpathname\n";
-                       system("mv $srcvideo \"$origpathname/".basename(dirname($srcvideo))."_".basename($srcvideo));
+                       if(index($srcvideo, basename(dirname($srcvideo))) == -1) { 
+                           system("mv $srcvideo \"$origpathname/".basename(dirname($srcvideo))."_".basename($srcvideo));
+                       } else {
+                           system("mv $srcvideo \"$origpathname/".basename($srcvideo));
+                       }
                    } else {
                        print "-> Removing the original video $srcvideo\n";
                        system("/bin/bash -c '[[ -e $srcvideo ]] && rm -f $srcvideo'");
index 6feee994672eb9cd475a1b803452ae599dc78131..290f37ce36f011422880c1bfcf7da11a5b6c980f 100755 (executable)
@@ -13,8 +13,8 @@ use File::Pid;
 # Configuration parameters
 my $movie_src_dir = "/naspool/dropbox/New Movies";
 my $mobile_movie_src_dir = "/naspool/dropbox/New Movies/Mobile";
-my $movie_dst_dir = "/naspool/movies";
-my $mobile_movie_dst_dir = "/naspool/movies/Mobile";
+my $movie_dst_dir = "/movpool/movies";
+my $mobile_movie_dst_dir = "/movpool/movies/Mobile";
 my $movie_done_dir = "/naspool/dropbox/Encoded";
 my $log = "/var/log/organize/organize_movies.log";
 my $encode_log = "/var/log/organize/organize_movies_encode.log";
index ef49df53054ec8a2dcbaf479d3dc121d09f19dfa..647e08d8f7ededd8fe745f0e3d4f32d4cc285546 100755 (executable)
@@ -54,12 +54,13 @@ my %month2monthname = (
                       "12" => "Dec"
                       );
 
-getopts("htvnkpd:");
+getopts("htvnkpfd:");
 
 sub usage {
-    print "usage: $0 [-v] [-t] [-r] [-p] [-d <dir>]\n";
+    print "usage: $0 [-v] [-t] [-r] [-p] [-f] [-d <dir>]\n";
     print "   -v        verbose; print file being moved (to).\n";
     print "   -t        test; print what will happen, but don't do anything\n";
+    print "   -f        force it to run by ignoring the \$minage setting in organize_videos.conf\n";
     print "   -n        do not copy to dest; do not copy the resultant video files to the destination dir\n";
     print "   -k        keep the individual video files that are merged. By default, after a merge, individual video files that were merged are removed\n";
     print "   -p        only recreate video playlists, do not process any video files. Do this for each year & month of video clips in the directory specified by -d <dir>.\n";
@@ -126,6 +127,7 @@ $video_files_found=`$find_cmd_with_mkv`;
 if(!$video_files_found) { exit 0; }
 
 # Only proceed if no files have changed in the past $cmin minutes
+if($opt_f) { $find_changed_cmd =~ s/cmin \S+ /cmin +0 /; }
 $changed_files_found=`$find_changed_cmd`;
 if($changed_files_found) { exit 0; }