September 25, 20196 yr Quote mv: cannot stat 'AUDIO_TS': No such file or directory mv: cannot stat 'VIDEO_TS': No such file or directory The mv will give an error if AUDIO_TS or VIDEO_TS do not exist. I left the error in there so you could see if either directory wasn't present. I can suppress the error if you want. Quote rev: stdin: Invalid or incomplete multibyte or wide character mv: cannot move 'VIDEO_TS' to '/mnt/user/unraid/dvdbackup/VIDEO_TS': Directory not empty I believe the reason the mv failed may be because of the rev error. I modified the script to use sed instead of rev. It may fix the error.
September 25, 20196 yr Author I just run a search for VIDEO_TS and AUDIO_TS and DVD in the subfolders, they are all gone, so that's worked! To double check, how do I find which folder does NOT contain *.mkv or movie.xml That will basically tell me if anything was wrong in the first place with a movie folder in the conversion or tagging process I run previously. I think this would complete first pass, and I could add the directory to emby
September 25, 20196 yr Do you want the script to move "movie.xml" to the parent directory like the mkv file? I could modify the script so that at the time of processing it checks if an mkv file exists, if not print a message. Or I could make a separate script to check if the files exist.
September 25, 20196 yr Author Do you want the script to move "movie.xml" to the parent directory like the mkv file? I could modify the script so that at the time of processing it checks if an mkv file exists, if not print a message. Or I could make a separate script to check if the files exist.I did many random checks they all seem to be there, I already run the other script, so a separate script that just checks that the two files are there and gives an error message when they are not, like the VIDEO_TS error messages, would be fantastic! Thank you so much for your help on this!Sent from my SM-A520F using Tapatalk
September 25, 20196 yr Check for movie.xml and mkv files in each movie folder. check_movies.sh #!/bin/bash movies="/mnt/user/test/movies" process() { local movieDir=$1 local mkv="$(find "$movieDir" -iname '*.mkv')" local xml="$(find "$movieDir" -iname 'movie.xml')" if [ -z "$mkv" ] || [ -z "$xml" ] then printf "$movieDir\n" [ -z "$mkv" ] && printf "\tmkv: file not found\n" [ -z "$xml" ] && printf "\tmovie.xml: file not found\n" fi } ls -1d "$movies"/*/ | sed 's/\/*$//' |\ while read movie do if [ -d "$movie/DVD1" ] then ls -1d "$movie"/DVD*/ | sed 's/\/*$//' |\ while read dvd do process "$dvd" done else process "$movie" fi done Edited September 25, 20196 yr by JoeUnraidUser
September 25, 20196 yr Author Check for movie.xml and mkv files in each movie folder. check_movies.sh#!/bin/bashmovies="/mnt/user/test/movies"process(){ local movieDir=$1 mkv="$(find "$movieDir" -iname '*.mkv' -print -quit)" xml="$(find "$movieDir" -iname 'movie.xml' -print -quit)" if [ -z "$mkv" ] || [ -z "$xml" ] then printf "$movieDir\n" fi if [ -z "$mkv" ] then printf "\tmkv: file not found\n" fi if [ -z "$xml" ] then printf "\tmovie.xml: file not found\n" fi}ls -1d "$movies"/*/ | sed 's/\/*$//' |\while read moviedo if [ -d "$movie/DVD1" ] then ls -1d "$movie"/DVD*/ | sed 's/\/*$//' |\ while read dvd do process "$dvd" done else process "$movie" fidone Awesome will test tonightSent from my SM-A520F using Tapatalk
September 25, 20196 yr Author Perfect. It found 43 folder with no MKV file, probably because the mkv creator failed to convert the video_TS folder when I automated the mkv file generation. Now I know what I need to fix, you have been fantastic, thanks Joe, this was a great help.
September 27, 20196 yr Author makemkv fails on those folder, but handbrake is converting most of them fine, so off they go! It's not a "non-transcoding" method like makemkv, but the results are pretty good anyway
December 25, 20196 yr Author Merry Xmas Joe, if I want to find out which movie folder within a directory does not have a .nfo file, do I just replace *.mkv with *.nfo in the script above? I don't have any dvd folders anymore as I have converted them all to mkvs.
December 27, 20196 yr On 12/25/2019 at 1:44 PM, gnollo said: Merry Xmas Joe, if I want to find out which movie folder within a directory does not have a .nfo file, do I just replace *.mkv with *.nfo in the script above? I don't have any dvd folders anymore as I have converted them all to mkvs. Yes, it should work.
January 17, 20206 yr Author It worked indeed! Thank you for that Joe. Now I need to identify which folder in my /mnt/user/test/movies contains subfolders. Need to get rid of them as emby does not deal well with them.
January 19, 20206 yr On 1/17/2020 at 1:57 AM, gnollo said: It worked indeed! Thank you for that Joe. Now I need to identify which folder in my /mnt/user/test/movies contains subfolders. Need to get rid of them as emby does not deal well with them. The following script will show the subfolders for each movie. To remove the subfolders; uncomment the following line: #rm -rf "$dir" to rm -rf "$dir" movies_subdirs.sh #!/bin/bash movies="/mnt/user/test/movies" process() { local movieDir=$1 readarray -t dirs < <(find "$movieDir" -mindepth 1 -maxdepth 1 -type d -print 2>/dev/null) if [ ${#dirs[@]} != 0 ] then printf "$movieDir\n" for dir in "${dirs[@]}" do printf "$dir\n" #rm -rf "$dir" done fi } ls -1d "$movies"/*/ | sed 's/\/*$//' |\ while read movie do if [ -d "$movie/DVD1" ] then ls -1d "$movie"/DVD*/ | sed 's/\/*$//' |\ while read dvd do process "$dvd" done else process "$movie" fi done
Archived
This topic is now archived and is closed to further replies.