Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: AutoRipDVD is brought to you by Spinalcracker
- :: Modified by Akevit :
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- @Echo on
- Setlocal enableextensions
- :: Enable Delayed Expansion allows for loops to iterate through each variable by using ! instead of % when calling variable
- Setlocal enabledelayedexpansion
- :: ScriptPath is now dynamically hardcoded to wherever the AutoRipDVD.bat file is, script will break If you move location of this file
- Set ScriptPath=%~dp0
- Set ScriptPath=%ScriptPath:~0,-1%
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Change the following variables to match your setup
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: DriveLetter=The drive letter of your DVD or Blu-Ray drive ie. D: or G: etc
- Set DriveLetter=E:
- :: RipDir=Where you want your DVD ripped to ie. your xbmc movie folder
- Set RipDir=I:\HD Movies
- :: IntDir=Where you installed MakeMKV to
- Set IntDir=C:\Program Files (x86)\MakeMKV
- :: RipMinSeconds=Minimum time In seconds that should be ripped off disk to avoid getting previews etc. Default is 3600 seconds or 1 hour
- Set RipMinSeconds=3600
- :: Eject Disc after ripping?
- Set EjectDisc=No
- :: Show splash screens
- Set ShowSplash=No
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: HANDBRAKE SETTINGS
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Using Handbrake to compress - Yes or No?
- Set Handbrake=Yes
- :: Sets the install path to handbrake
- Set Handbrakepath=C:\Program Files\Handbrake
- :: Log Handbrake?
- Set Handbrakelog=Yes
- Set HandbrakelogDirectory=%scriptpath%
- :: Keep backup of original file after compression? (Otherwise original full quality video will be deleted from Hard Drive -- They're quite large)
- Set KeepHDVersion=Yes
- Set OriginalBackupDir=I:\Oringal HD Rips
- :: Enter profile For handbrake settings to use (see end of this file)
- Set HBsettings=720pHigh
- :: Experimental procedure to only encode the largest extracted MKV and append .delete to the others
- Set encodeLargestOnly=Yes
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: XBMC Settings For Library Update
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Update XBMC Library Upon completion?
- :: NOTE: CURL For Windows MUST BE INSTALLED: http://curl.haxx.se/download.html
- Set UpdateXBMC=Yes
- :: Add arbitrary NFO.txt file For file If wanted
- :: Will need to manually add URL to NFO file For scraper to work
- Set AddNFO=Yes
- ::*** Which version of XBMC are you using? Enter FroDo or Eden
- Set XBMCversion=Frodo
- :: Set logIn details For XBMC HTTP access (settings found In XBMC Network settings)
- Set XBMCuser=xbmc
- Set XBMCpass=xbmc
- Set XBMCurl=127.0.0.1
- Set XBMCport=8082
- Set cURLpath=C:\cURL\curl.exe
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Debug Test Mode
- Set TestMode=No
- ::*********************************************************************************************
- ::*********************************************************************************************
- ::******* Do NOT EDIT ANYTHING BELOW THIS!!!!!!************************************************
- ::*********************************************************************************************
- ::*********************************************************************************************
- :StartScript
- :: Set volid = label name
- For /f "tokens=1-5*" %%1 In ('vol %DriveLetter%') Do (
- Set volid=%%6
- Goto :processcontd
- )
- :processcontd
- :: Remove trailing space from label name if exists
- If "%volid:~-1,1%"==" " Set volid=%volid:~0,-1%
- Echo Volid:[%volid%]
- :GetDiscNum
- :: Get disc number based on name of %volid%
- "%IntDir%\makemkvcon64.exe" -r --cache=1 info disc:9999 | Find /i "%volid%" > "%userprofile%\ARtemp"
- Set /p discNum=<"%userprofile%\ARtemp"
- Del "%userprofile%\ARtemp"
- Set discNum=%discNum:~4,1%
- :: Checking For drive
- Set str=%volid%
- Set str=%str:_= %
- Set volid=%str%
- If "%volid%"=="_= " Call :NoDrive
- Echo:Ripping %volid% now...
- Echo %date% %time%: Begin Script [%volid%] >> "%scriptpath%\AutoRipLog.txt"
- :: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- :: Go to test mode
- If %testmode%==Yes Goto :Testing
- :: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- :: Creating directory to rip DVD as an MKV to
- Mkdir "%RipDir%\%volid%"
- :: Launch AutoRip splash screen
- If %ShowSplash%==Yes Call "%ScriptPath%\OSDAutoRip.hta"
- :: Ripping DVD to MKV file
- Cd /d "%IntDir%"
- Echo %date% %time%: Ripping [%volid%] >> "%scriptpath%\AutoRipLog.txt"
- :: Rip with MakeMKV?
- Echo 1. Rip with MakeMKV
- Echo 2. Skip Rip with MakeMKV
- Set /P UseMakeMKV=Please select a number:
- If %UseMakeMKV%==1 Call :Rip_With_MakeMKV
- :EndingScripts
- If %Handbrake%==Yes Call :HBEncode
- If %UpdateXBMC%==Yes Call :UpdateLibrary
- If %AddNFO%==Yes Call :AddNFOscript
- :ScriptComplete
- Cd /d "%ScriptPath%"
- If %EjectDisc%==Yes Call AutoRipComplete.vbs
- Echo %date% %time%: End Script [%volid%] >> "%scriptpath%\AutoRipLog.txt"
- cscript Beep.vbs
- PAUSE
- EXIT
- :: Start of various ending scripts
- :NoDrive
- Cd /d "%ScriptPath%"
- Echo %date% %time%: End Script [%volid%] >> "%scriptpath%\AutoRipLog.txt"
- cscript Beep.vbs
- NoDiskDrive.hta
- AutoRipComplete.vbs
- EXIT
- :Rip_With_MakeMKV
- makemkvcon64.exe --minlength=%RipMinSeconds% mkv disc:%discNum% all "%RipDir%\%volid%"
- Echo %date% %time%: Rip complete [%volid%] >> "%scriptpath%\AutoRipLog.txt"
- :Goto :EOF
- :HBEncode
- Call :%HBsettings%
- Echo %date% %time%: BegIn HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
- Cd /d "%Handbrakepath%"
- :: Setting Handbrakelog, double quotes necessary otherwise output won't be written
- If %Handbrakelog%==Yes Set LOG="--verbose=1 2> "%HandbrakelogDirectory%\HandbrakeLog.txt""
- :: !Experimental! - Only encode largest mkv file and rename others
- If %encodeLargestOnly%==Yes Call :renameSmallerMKVs
- :: Encoding each video file separately and appending %RESOLUTION% variable to filename
- For %%m In ("%RipDir%\%volid%\*.mkv") Do (
- Set num=%%m
- Set num=!num:~-6,2!
- HandBrakeCLI -i "%%m" -o "%RipDir%\%volid%\%volid% [!num!] %RESOLUTION%.mkv" %PICTURE% %VIDEO% %AUDIO% %ADVANCED% %LOG:~1,-1%
- :: This has potential not to work either since it doesn't iterate properly
- Call :HBEncodeLogSection
- )
- Cd /d %_tmpPath%
- If %KeepHDVersion%==Yes Goto :KeepHDLabel
- Del "%volid%_*.mkv"
- Goto :EOF
- :renameSmallerMKVs
- Dir "%RipDir%\%volid%\*.mkv" /b /o-s>{temp}
- Set /P biggestMKV=<{temp}
- Del {temp}
- For %%f In ("%RipDir%\%volid%\*.mkv") Do (
- If Not "%%f"=="%RipDir%\%volid%\%biggestMKV%" (
- Ren "%%f" *.delete
- )
- )
- Goto :EOF
- :HBEncodeLogSection
- ECHO %date% %time%: End HB Encode [%%m] >> "%scriptpath%\AutoRipLog.txt"
- Goto :EOF
- :: This only works for encoding one movie as keepFile could potentially contain multiple 720p files
- :: Should find a way to iterate through
- :: Potential problem with how it iterates through and renaming a file that has already been renamed or something
- :KeepHDLabel
- Mkdir "%OriginalBackupDir%\%volid%"
- Dir /b "%RipDir%\%volid%\*%RESOLUTION%.mkv">{temp}
- Set /P keepFile=<{temp}
- Del {temp}
- For %%f in ("%RipDir%\%volid%\*_*") do (
- If Not "%%f"=="%RipDir%\%volid%\%keepFile%" (
- Move "%%f" "%OriginalBackupDir%\%volid%"
- )
- )
- Goto :EOF
- :AddNFOscript
- Echo http://www.themoviedb.org/movie/ > "%RipDir%\%volid%\%titlename%.NFO.ADD URL FROM TMDB or TVDB WHEN NEEDED.txt"
- Goto :EOF
- :UpdateLibrary
- If %XBMCversion%==FroDo Goto :UpdateLibraryFrodo
- If %XBMCversion%==Eden Goto :UpdateLibraryEden
- Goto :EOF
- :UpdateLibraryFrodo
- "%cURLpath%" -i -H "Content-Type: application/json" -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\"}" http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/jsonrpc
- Goto :EOF
- :UpdateLibraryEden
- "%cURLpath%" --get "http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)"
- Goto :EOF
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Change or add Handbrake Settings here :
- :: Format follows the tabs In handbrake, PICTURE settings include video filter as this is how it's referenced In the CLIGuide :
- :: For full explanations of settings, see here: https://trac.handbrake.fr/wiki/CLIGuide :
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :OriginalSettings
- Set RESOLUTION=720p
- Set PICTURE=--format mkv --width 1280
- Set VIDEO=-m -e x264 --quality 23
- Set AUDIO=--ab 64 --mixdown mono
- Set ADVANCED=-x b-adapt=2:rc-lookahead=50:me=umh:bframes=5:ref=6:direct=auto:trellis=2:subq=10:psy-rd=1.0,0.10:analyse=all
- Goto :EOF
- :720pHigh
- Set RESOLUTION=720p
- Set PICTURE=-f mkv --decomb -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2
- Set VIDEO=-m -e x264 -q 20 --vfr
- Set AUDIO=-a 1,1 -E faac,copy:ac3 -B 160,0 -6 dpl2,auto -R Auto,Auto -D 0,0 --gain=0,0 --audio-copy-mask none --audio-fallback ffac3
- Set ADVANCED=-x b-adapt=2:rc-lookahead=50:ref=6:bframes=6:me=umh:subq=9:merange=64:analyse=all
- Goto :EOF
- :720pLow
- Set RESOLUTION=720p
- Set PICTURE=-f mkv -w 1280 --loose-anamorphic
- Set VIDEO=-m -e x264 -q 20 -r 29.97 --pfr
- Set AUDIO=-a 1,1 -E faac,ffac3 -B 160,0 -6 dpl2,auto -R Auto,Auto -D 0,0 --gain=0,0 --audio-copy-mask none --audio-fallback ffac3
- Set ADVANCED=--x264-profile high
- Goto :EOF
- :720pMedium
- Set RESOLUTION=720p
- Set PICTURE=-f mkv --decomb -w 1280 --loose-anamorphic --modulus 2
- Set VIDEO=-m -e x264 -q 20 --vfr
- Set AUDIO=-a 1,1 -E faac,ffac3 -B 160,0 -6 dpl2,auto -R Auto,Auto -D 0,0 --gain=0,0 --audio-copy-mask none --audio-fallback ffac3
- Set ADVANCED=-x b-adapt=2:rc-lookahead=50
- Goto :EOF
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: TESTING CODE AREA IGNORE
- :Testing
- @Echo ON
- Set RipDir=%RipDir%\Testing
- Echo http://www.themoviedb.org/movie/ > "%RipDir%\movie.NFO.ADD URL FROM TMDB WHEN NEEDED.txt"
- :: Creating directory to rip DVD as an MKV to
- :: Mkdir "%RipDir%\%volid%"
- :: "%IntDir%\makemkvcon64.exe" --minlength=%RipMinSeconds% mkv disc:%discNum% all "%RipDir%\%volid%"
- :: Cd /D "%RipDir%\%volid%"
- :: Rename * %volid%.MKV
- ::If %Handbrakelog%==Yes Call HandBrakeCLI -i "%RipDir%\%volid%" -o "%RipDir%\%volid%\%volid% %RESOLUTION%.mkv" %PICTURE% %VIDEO% %AUDIO% %ADVANCED% --verbose=1 2> "%HandbrakelogDirectory%\HandbrakeLog.txt"
- ::If %Handbrakelog%==No Call HandBrakeCLI -i "%RipDir%\%volid%" -o "%RipDir%\%volid%\%volid% %RESOLUTION%.mkv" %PICTURE% %VIDEO% %AUDIO% %ADVANCED%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement