From: Alan J. Pippin Date: Sat, 15 Jul 2017 17:17:49 +0000 (-0600) Subject: Added force option to organize_videos which ignores $minage X-Git-Url: http://git.pippins.net/embedvideo/.git/%7Bdelete%7D?a=commitdiff_plain;h=5a4d4d3ceec69ce1973f790d0c9f27be9e38339b;p=videoscripts%2F.git Added force option to organize_videos which ignores $minage Updated path to movie directory Fixed Original copying logic in organize_videos to avoid double date bug --- diff --git a/homevideo_random.pl b/homevideo_random.pl index 4e5a81a..23376b1 100755 --- a/homevideo_random.pl +++ b/homevideo_random.pl @@ -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; diff --git a/make_mobile_movie b/make_mobile_movie index e4d2331..53e293c 100755 --- a/make_mobile_movie +++ b/make_mobile_movie @@ -1,7 +1,7 @@ #!/bin/bash DROPBOX="/naspool/dropbox/New Movies" -MOVIEDIR="/naspool/movies" +MOVIEDIR="/movpool/movies" MOVIE="$1" CATEGORY="$2" diff --git a/merge_videos_by_day b/merge_videos_by_day index 4a58f0f..7179746 100755 --- a/merge_videos_by_day +++ b/merge_videos_by_day @@ -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'"); diff --git a/organize_movies b/organize_movies index 6feee99..290f37c 100755 --- a/organize_movies +++ b/organize_movies @@ -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"; diff --git a/organize_videos b/organize_videos index ef49df5..647e08d 100755 --- a/organize_videos +++ b/organize_videos @@ -54,12 +54,13 @@ my %month2monthname = ( "12" => "Dec" ); -getopts("htvnkpd:"); +getopts("htvnkpfd:"); sub usage { - print "usage: $0 [-v] [-t] [-r] [-p] [-d ]\n"; + print "usage: $0 [-v] [-t] [-r] [-p] [-f] [-d ]\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 .\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; }