JoeUnraidUser Posted September 25, 2019 Share Posted September 25, 2019 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. Quote Link to comment
gnollo Posted September 25, 2019 Author Share Posted September 25, 2019 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 Quote Link to comment
JoeUnraidUser Posted September 25, 2019 Share Posted September 25, 2019 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. Quote Link to comment
gnollo Posted September 25, 2019 Author Share Posted September 25, 2019 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 Quote Link to comment
JoeUnraidUser Posted September 25, 2019 Share Posted September 25, 2019 (edited) 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, 2019 by JoeUnraidUser Quote Link to comment
gnollo Posted September 25, 2019 Author Share Posted September 25, 2019 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 Quote Link to comment
gnollo Posted September 25, 2019 Author Share Posted September 25, 2019 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. Quote Link to comment
gnollo Posted September 27, 2019 Author Share Posted September 27, 2019 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 Quote Link to comment
gnollo Posted December 25, 2019 Author Share Posted December 25, 2019 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. Quote Link to comment
JoeUnraidUser Posted December 27, 2019 Share Posted December 27, 2019 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. 1 Quote Link to comment
gnollo Posted January 17, 2020 Author Share Posted January 17, 2020 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. Quote Link to comment
JoeUnraidUser Posted January 19, 2020 Share Posted January 19, 2020 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 Quote Link to comment
gnollo Posted January 19, 2020 Author Share Posted January 19, 2020 Thank you again, works like a charm! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.