Advertisement
kyrios2021

AutoRipDVD (Alpha)

Dec 21st, 2012
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.72 KB | None | 0 0
  1. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. :: AutoRipDVD is brought to you by Spinalcracker
  3. :: Modified by Akevit
  4. :: Modified again by Jason Hurley :) :
  5. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6. @Echo on
  7. Setlocal enableextensions
  8. :: Enable Delayed Expansion allows for loops to iterate through each variable by using ! instead of % when calling variable
  9. Setlocal enabledelayedexpansion
  10. :: ScriptPath is now dynamically hardcoded to wherever the AutoRipDVD.bat file is, script will break If you move location of this file
  11. Set ScriptPath=%~dp0
  12. Set ScriptPath=%ScriptPath:~0,-1%
  13. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14. :: Change the following variables to match your setup
  15. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16. :: DriveLetter=The drive letter of your DVD or Blu-Ray drive ie. D: or G: etc
  17. Set DriveLetter=D:
  18.  
  19. :: RipDir=Where you want your DVD ripped to ie. your xbmc movie folder
  20. Set RipDir=B:\UncompressedMovies
  21.  
  22. :: Encoded Directory of where it saves
  23. Set EncodeDir=G:\movies\
  24.  
  25. ::Encode Directory of Tv Shows
  26. Set TVEncodeDir=I:\Tv Shows
  27.  
  28. :: IntDir=Where you installed MakeMKV to
  29. Set IntDir=C:\Program Files (x86)\MakeMKV
  30.  
  31. :: RipMinSeconds=Minimum time In seconds that should be ripped off disk to avoid getting previews etc. Default is 3600 seconds or 1 hour
  32. Set RipMinSeconds=3600
  33.  
  34. :: Eject Disc after ripping?
  35. Set EjectDisc=No
  36.  
  37. :: Show splash screens
  38. Set ShowSplash=No
  39. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  40. ::: Media Companion
  41. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  42. :::Open MediaCompanion. Since there was no installation, you just run the downloaded executable. Select the “Movies” tab in the first row, and then the
  43. ::“Folders” tab in the second row. Click “Add Movie Folder Browser” and navigate to wherever you’re storing your movies. Click OK, and then click
  44. ::“Save & Quick Refresh”. MC will search the folder(s) you specified for media items. Note that it hasn’t scraped anything yet.
  45.  
  46. ::On the second tab row (still in Movies) select “Movie Preferences”. These settings are all optional, except that “Use Folder Names for Scraping”
  47. ::(near the bottom left) MUST be checked.
  48.  
  49. :: Sets Media Companion Directory ( For those that use this setting make sure you look at XMBC Set Scan of media Companion
  50. :: http://mediacompanion.codeplex.com/ (requires .net 4.0)
  51. Set MediaDir=c:\MediaCompanion3.500
  52. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  53. :: HANDBRAKE SETTINGS
  54. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  55.  
  56.  
  57. :: Sets the install path to handbrake
  58. Set Handbrakepath=C:\Program Files\Handbrake
  59.  
  60. :: Log Handbrake?
  61. Set Handbrakelog=Yes
  62. Set HandbrakelogDirectory=%scriptpath%
  63.  
  64.  
  65. :: Experimental procedure to only encode the largest extracted MKV and append .delete to the others and delete
  66. Set encodeLargestOnly=Yes
  67. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  68. ::: HANDBRAKE SETTINGS PART 2 - Below Settings do not matter if Advanced mode is on
  69. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  70. :: Using Handbrake to compress - Yes or No?
  71. Set Handbrake=Yes
  72.  
  73.  
  74. :: Keep backup of original file after compression? (Otherwise original full quality video will be deleted from Hard Drive -- They're quite large)
  75. Set KeepHDVersion=Yes
  76.  
  77.  
  78. :: Enter profile For handbrake settings to use (see end of this file)
  79. Set HBsettings=1080pHigh
  80.  
  81. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  82. :: XBMC Settings For Library Update
  83. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  84.  
  85. :: Media Companion Folders need to be Set in Media Companion Prior To Running this Scan.
  86. ::Sets Scan of Media Companion
  87. Set MediaComp=Yes
  88.  
  89. :: Update XBMC Library Upon completion?
  90. :: NOTE: CURL For Windows MUST BE INSTALLED: http://curl.haxx.se/download.html
  91. Set UpdateXBMC=Yes
  92.  
  93. :: Add arbitrary NFO.txt file For file If wanted
  94. :: Will need to manually add URL to NFO file For scraper to work
  95. Set AddNFO=No
  96.  
  97. ::*** Which version of XBMC are you using? Enter FroDo or Eden
  98. Set XBMCversion=Frodo
  99.  
  100. :: Set logIn details For XBMC HTTP access (settings found In XBMC Network settings)
  101. Set XBMCuser=xbmc
  102. Set XBMCpass=xbmc
  103. Set XBMCurl=127.0.0.1
  104. Set XBMCport=8082
  105. Set cURLpath=C:\cURL\curl.exe
  106.  
  107. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  108. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  109. :: Debug Test Mode
  110. Set TestMode=No
  111. ::*********************************************************************************************
  112. ::*********************************************************************************************
  113. ::******* Do NOT EDIT ANYTHING BELOW THIS!!!!!!************************************************
  114. ::*********************************************************************************************
  115. ::*********************************************************************************************
  116. :StartScript
  117. :: Set volid = label name
  118. For /f "tokens=1-5*" %%1 In ('vol %DriveLetter%') Do (
  119. Set volid=%%6
  120. Goto :processcontd
  121. )
  122.  
  123. :processcontd
  124. :: Remove trailing space from label name if exists
  125. If "%volid:~-1,1%"==" " Set volid=%volid:~0,-1%
  126. Echo Volid:[%volid%]
  127.  
  128. :GetDiscNum
  129. :: Get disc number based on name of %volid%
  130. "%IntDir%\makemkvcon64.exe" -r --cache=1 info disc:9999 | Find /i "%volid%" > "%userprofile%\ARtemp"
  131. Set /p discNum=<"%userprofile%\ARtemp"
  132. Del "%userprofile%\ARtemp"
  133. Set discNum=%discNum:~4,1%
  134.  
  135. :: Checking For drive
  136. Set str=%volid%
  137. Set str=%str:_= %
  138. Set volid=%str%
  139. If "%volid%"=="_= " Call :NoDrive
  140.  
  141. Echo:Ripping %volid% now...
  142. Echo %date% %time%: Begin Script [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  143. :: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  144. :: Go to AdvancedMode
  145.  
  146. Call :AdvancedModeOption
  147. cd /d %ScriptPath%
  148. Set /p AdvancedMode=<value.txt
  149. del value.txt
  150. If %AdvancedMode%==1 GoTo :Advanced
  151.  
  152.  
  153.  
  154. :: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  155.  
  156. :: Creating directory to rip DVD as an MKV to
  157. Mkdir "%RipDir%\%volid%"
  158.  
  159. :: Launch AutoRip splash screen
  160. If %ShowSplash%==Yes Call "%ScriptPath%\OSDAutoRip.hta"
  161.  
  162. :: Ripping DVD to MKV file
  163. Cd /d "%IntDir%"
  164. Echo %date% %time%: Ripping [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  165.  
  166. :: Rip with MakeMKV?
  167. if not exist "%RipDir%\%volid%\*.mkv" call :Rip_With_MakeMKV
  168.  
  169.  
  170. ::Check if more than one file exists for uncompressed mkv and deletes all but biggest
  171.  
  172. ::!!!!!!!!!!!!!!!!!!!!!!!!!
  173. ::Cd /d %RipDir%%volid%
  174. ::for /f "skip=1delims=" %%i in ( ' dir /b /a-d /o-d "*.mkv" ' ) do ECHO del
  175. ::!!!!!!!!!!!!!!!!!!!!!!!!!!!
  176. If %encodeLargestOnly%==Yes Call :renameSmallerMKVs
  177.  
  178. ::Change Ripped File Name
  179. cd /d %RipDir%\%volid%
  180. if not exist "%volid%.mkv" Call :rename
  181.  
  182. ::Handbrake Compression
  183. If %Handbrake%==Yes Call :HBEncode
  184.  
  185. :AdvancedExit
  186.  
  187. :EndingScripts
  188. If %MediaComp%==Yes Call :MediaComp
  189. If %UpdateXBMC%==Yes Call :UpdateLibrary
  190. If %AddNFO%==Yes Call :AddNFOscript
  191.  
  192. :ScriptComplete
  193. Cd /d "%ScriptPath%"
  194. If %EjectDisc%==Yes Call AutoRipComplete.vbs
  195. Echo %date% %time%: End Script [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  196. cscript Beep.vbs
  197. PAUSE
  198. EXIT
  199.  
  200. :: Start of various ending scripts
  201. :NoDrive
  202. Cd /d "%ScriptPath%"
  203. Echo %date% %time%: End Script [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  204. cscript Beep.vbs
  205. NoDiskDrive.hta
  206. AutoRipComplete.vbs
  207. EXIT
  208.  
  209. :Rip_With_MakeMKV
  210. makemkvcon64.exe --minlength=%RipMinSeconds% mkv disc:%discNum% all "%RipDir%\%volid%"
  211. Echo %date% %time%: Rip complete [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  212. Goto :EOF
  213.  
  214. :HBEncode
  215. Mkdir "%EncodeDir%\%volid%"
  216. Call :%HBsettings%
  217. Echo %date% %time%: BegIn HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  218. Cd /d "%Handbrakepath%"
  219. HandBrakeCLI -v0 -i "%RipDir%\%volid%" -o "%EncodeDir%\%volid%\%volid%.%RESOLUTION%.mkv" %PICTURE% %VIDEO% %AUDIO% %ADVANCED%
  220. ECHO %date% %time%: End HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  221.  
  222. :: Setting Handbrakelog, double quotes necessary otherwise output won't be written
  223. ::If %Handbrakelog%==Yes Set LOG="--verbose=1 2> "%HandbrakelogDirectory%\HandbrakeLog.txt""
  224.  
  225. Cd /d "%RipDir%%volid%"
  226. If %KeepHDVersion%==No Del "%volid%_*.mkv"
  227. Goto :EOF
  228.  
  229. :renameSmallerMKVs
  230. Dir "%RipDir%\%volid%\*.mkv" /b /o-s>{temp}
  231. Set /P biggestMKV=<{temp}
  232. Del {temp}
  233. For %%f In ("%RipDir%\%volid%\*.mkv") Do (
  234. If Not "%%f"=="%RipDir%\%volid%\%biggestMKV%" (
  235. Ren "%%f" *.delete
  236. )
  237. )
  238. Del "%RipDir%\%volid%\*.delete"
  239. Goto :EOF
  240.  
  241.  
  242. :HBEncodeLogSection
  243. ECHO %date% %time%: End HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  244. Goto :EOF
  245.  
  246. :rename
  247. cd /d "%RipDir%\%volid%"
  248. ren "*.mkv" "%volid%.mkv"
  249. GoTo :EOF
  250.  
  251. :MediaComp
  252. Cd /d %MediaDir%
  253. mc_com.exe -m
  254. Goto :EOF
  255.  
  256.  
  257. :AddNFOscript
  258. Echo http://www.themoviedb.org/movie/ > "%RipDir%\%volid%\%titlename%.NFO.ADD URL FROM TMDB or TVDB WHEN NEEDED.txt"
  259. Goto :EOF
  260.  
  261. :UpdateLibrary
  262. If %XBMCversion%==FroDo Goto :UpdateLibraryFrodo
  263. If %XBMCversion%==Eden Goto :UpdateLibraryEden
  264. Goto :EOF
  265.  
  266. :UpdateLibraryFrodo
  267. "%cURLpath%" -i -H "Content-Type: application/json" -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\"}" http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/jsonrpc
  268. Goto :EOF
  269.  
  270. :UpdateLibraryEden
  271. "%cURLpath%" --get "http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
  272. Goto :EOF
  273.  
  274. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  275. ::AdvancedMode Script Input
  276. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  277. ::::::::::;DO NOT EDIT::::::::::::::::::::::::::::::::::
  278. :::::::::::::::::::::::::::::::::::::::::::::::::::::::
  279.  
  280. :Advanced
  281.  
  282. Call :CorrectMovieName
  283. cd /d %ScriptPath%
  284. Set /p MovieChange=<value.txt
  285. del value.txt
  286.  
  287. if %MovieChange%==2 call :ChangeName
  288. ::if %MovieChange%==2 call :RerunOpening
  289. :: Creating directory to rip DVD as an MKV to
  290. Mkdir "%RipDir%\%volid%"
  291.  
  292. :: Launch AutoRip splash screen
  293. If %ShowSplash%==Yes Call "%ScriptPath%\OSDAutoRip.hta"
  294.  
  295. :: Ripping DVD to MKV file
  296. Cd /d "%IntDir%"
  297. Echo %date% %time%: Ripping [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  298.  
  299. cd /d %ScriptPath%
  300. del Advanced.txt
  301. del value.txt
  302. ::Choice about MKV
  303.  
  304.  
  305. Call :DVDType
  306. cd /d %ScriptPath%
  307. Set /p MovieorTV2=<value.txt
  308. del value.txt
  309.  
  310. if %MovieorTV2%==2 call :TVStart
  311.  
  312. call :RiptoMKV
  313. cd /d %ScriptPath%
  314. Set /p RiptoMKV=<value.txt
  315. del value.txt
  316.  
  317.  
  318. Call :EncodeWithHandbrake
  319. cd /d %ScriptPath%
  320. Set /p EncodewithHandbrake=<value.txt
  321. del value.txt
  322.  
  323.  
  324. Call :KeepUncompressedVersion
  325. cd /d %ScriptPath%
  326. Set /p KeepUncompressed=<value.txt
  327. del value.txt
  328.  
  329. If %EncodewithHandbrake%==1 Call :EncodingSettings
  330.  
  331. Cd /d "%IntDir%"
  332. If %RiptoMKV%==1 Call :Rip_With_MakeMKV
  333.  
  334. ::Change Ripped File Name
  335. ::cd /d %RipDir%\%volid%
  336. ::if not exist "%volid%.mkv" goto :rename
  337.  
  338. ::Check if more than one file exists for uncompressed mkv and deletes all but biggest
  339.  
  340. ::!!!!!!!!!!!!!!!!!!!!!!!!!
  341. ::Cd /d %RipDir%%volid%
  342. ::for /f "skip=1delims=" %%i in ( ' dir /b /a-d /o-d "*.mkv" ' ) do ECHO del
  343. ::!!!!!!!!!!!!!!!!!!!!!!!!!!!
  344. If %encodeLargestOnly%==Yes Call :renameSmallerMKVs
  345. if not exist "%volid%.mkv" Call :rename
  346.  
  347.  
  348. If %EncodewithHandbrake%==1 Call :AdvancedHandbrake
  349.  
  350.  
  351. If %KeepUncompressed%==2 Call :DeleteOriginal
  352.  
  353.  
  354. GoTo :AdvancedExit
  355.  
  356. ::Encoding Section for Handbrake
  357.  
  358. :AdvancedHandbrake
  359. Mkdir "%EncodeDir%\%volid%"
  360. ::Call :EncodingSettings
  361. ::cd /d %ScriptPath%
  362. ::Set /p EncodingSettings=<value.txt
  363. ::del value.txt
  364. If %EncodingSettings%==1 Call :720pLow
  365. If %EncodingSettings%==2 Call :720pMedium
  366. If %EncodingSettings%==3 Call :720pHigh
  367. If %EncodingSettings%==4 Call :1080pLow
  368. If %EncodingSettings%==5 Call :1080pMedium
  369. If %EncodingSettings%==6 Call :1080pHigh
  370. Echo %date% %time%: BegIn HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  371. Cd /d "%Handbrakepath%"
  372. HandBrakeCLI -v0 -i "%RipDir%\%volid%" -o "%EncodeDir%\%volid%\%volid%.%RESOLUTION%.mkv" %PICTURE% %VIDEO% %AUDIO% %ADVANCED%
  373. ECHO %date% %time%: End HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  374.  
  375. :: Setting Handbrakelog, double quotes necessary otherwise output won't be written
  376. ::If %Handbrakelog%==Yes Set LOG="--verbose=1 2> "%HandbrakelogDirectory%\HandbrakeLog.txt""
  377.  
  378. Goto :EOF
  379.  
  380.  
  381. :DeleteOriginal
  382. Cd /d "%RipDir%\%volid%"
  383. Del "%volid%*.mkv"
  384. Cd /d "%RipDir%"
  385. Del "%volid%"
  386. Goto :EOF
  387.  
  388. :RiptoMKV
  389. cd /d %ScriptPath%
  390. del Advanced.txt
  391. Set Rip=1
  392. echo %Rip% >>Advanced.txt
  393. start /wait Advanced.bat
  394. del Advanced.txt
  395. GoTo :EOF
  396.  
  397. :EncodewithHandbrake
  398. cd /d %ScriptPath%
  399. del Advanced.txt
  400. Set Encode=2
  401. echo %Encode% >>Advanced.txt
  402. start /wait Advanced.bat
  403. del Advanced.txt
  404. GoTo :EOF
  405.  
  406. :EncodingSettings
  407. cd /d %ScriptPath%
  408. del Advanced.txt
  409. Set EnSettings=3
  410. echo %EnSettings% >>Advanced.txt
  411. start /wait Advanced.bat
  412. del Advanced.txt
  413. cd /d %ScriptPath%
  414. Set /p EncodingSettings=<value.txt
  415. del value.txt
  416. GoTo :EOF
  417.  
  418. :TVEncodingSettings
  419. cd /d %ScriptPath%
  420. del Advanced.txt
  421. Set TVEnSettings=12
  422. echo %TVEnSettings% >>Advanced.txt
  423. start /wait Advanced.bat
  424. del Advanced.txt
  425. cd /d %ScriptPath%
  426. Set /p TVEncodingSettings=<value.txt
  427. del value.txt
  428. GoTo :EOF
  429.  
  430. :KeepUncompressedVersion
  431. cd /d %ScriptPath%
  432. del Advanced.txt
  433. Set Keep=4
  434. echo %Keep% >>Advanced.txt
  435. start /wait Advanced.bat
  436. del Advanced.txt
  437. GoTo :EOF
  438.  
  439. :SelectFile
  440. cd /d %ScriptPath%
  441. del Advanced.txt
  442. Set Select=5
  443. echo %Select% >>Advanced.txt
  444. start /wait Advanced.bat
  445. del Advanced.txt
  446. GoTo :EOF
  447.  
  448. :AdvancedModeOption
  449. cd /d %ScriptPath%
  450. del Advanced.txt
  451. Set AMO=6
  452. echo %AMO% >>Advanced.txt
  453. start /wait Advanced.bat
  454. del Advanced.txt
  455. GoTo :EOF
  456.  
  457. :DVDType
  458. cd /d %ScriptPath%
  459. del Advanced.txt
  460. Set Type=7
  461. echo %Type% >>Advanced.txt
  462. start /wait Advanced.bat
  463. del Advanced.txt
  464. GoTo :EOF
  465.  
  466. :TVLengthRecord
  467. cd /d %ScriptPath%
  468. del Advanced.txt
  469. Set LengthRecord=8
  470. echo %LengthRecord% >>Advanced.txt
  471. start /wait Advanced.bat
  472. del Advanced.txt
  473. GoTo :EOF
  474.  
  475. :CorrectMovieName
  476. cd /d %ScriptPath%
  477. del Advanced.txt
  478. Set Movie=9
  479. echo %Movie% >>Advanced.txt
  480. start /wait Advanced.bat
  481. del Advanced.txt
  482. GoTo :EOF
  483.  
  484. :SeasonNumber
  485. cd /d %ScriptPath%
  486. del Advanced.txt
  487. Set SN=10
  488. echo %SN% >>Advanced.txt
  489. start /wait Advanced.bat
  490. del Advanced.txt
  491. GoTo :EOF
  492.  
  493. :ChangeName
  494. cd /d %ScriptPath%
  495. del Advanced.txt
  496. Set Change=11
  497. echo %Change% >>Advanced.txt
  498. start /wait Advanced.bat
  499. del Advanced.txt
  500. cd /d %ScriptPath%
  501. Set /p volid=<value.txt
  502. del value.txt
  503. GoTo :EOF
  504.  
  505. :RerunOpening
  506. :: Get disc number based on name of %volid%
  507. "%IntDir%\makemkvcon64.exe" -r --cache=1 info disc:9999 | Find /i "%volid%" > "%userprofile%\ARtemp"
  508. Set /p discNum=<"%userprofile%\ARtemp"
  509. Del "%userprofile%\ARtemp"
  510. Set discNum=%discNum:~4,1%
  511.  
  512. :: Checking For drive
  513. Set str=%volid%
  514. Set str=%str:_= %
  515. Set volid=%str%
  516.  
  517.  
  518. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  519. ::: Advanced TV Section
  520. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  521. :TVStart
  522.  
  523. Set Folder=Season
  524.  
  525. call :RiptoMKV
  526. cd /d %ScriptPath%
  527. Set /p RiptoMKV=<value.txt
  528. del value.txt
  529.  
  530.  
  531. Call :EncodeWithHandbrake
  532. cd /d %ScriptPath%
  533. Set /p EncodewithHandbrake=<value.txt
  534. del value.txt
  535.  
  536.  
  537. Call :KeepUncompressedVersion
  538. cd /d %ScriptPath%
  539. Set /p KeepUncompressed=<value.txt
  540. del value.txt
  541.  
  542. Call :TVLengthRecord
  543. cd /d %ScriptPath%
  544. Set /p TVLength2=<value.txt
  545. del value.txt
  546.  
  547. Call :SeasonNumber
  548. cd /d %ScriptPath%
  549. Set /p Season=<value.txt
  550. del value.txt
  551.  
  552. cd /d "%RipDir%\%volid%"
  553. Mkdir "%Folder% %Season%"
  554.  
  555. If %EncodewithHandbrake%==1 Call :TVEncodingSettings
  556.  
  557. Cd /d "%IntDir%"
  558. If %RiptoMKV%==1 Call :Advanced_Rip_With_MakeMKV
  559.  
  560. ::Change Ripped File Name
  561. ::cd /d %RipDir%\%volid%
  562. ::if not exist "%volid%.mkv" goto :rename
  563.  
  564. ::Check if more than one file exists for uncompressed mkv and deletes all but biggest
  565.  
  566. ::!!!!!!!!!!!!!!!!!!!!!!!!!
  567. ::Cd /d %RipDir%%volid%
  568. ::for /f "skip=1delims=" %%i in ( ' dir /b /a-d /o-d "*.mkv" ' ) do ECHO del
  569. ::!!!!!!!!!!!!!!!!!!!!!!!!!!!
  570. ::If %encodeLargestOnly%==Yes Call :renameSmallerMKVs
  571. ::if not exist "%volid%.mkv" Call :rename
  572.  
  573.  
  574. If %EncodewithHandbrake%==1 Call :AdvancedTVHandbrake
  575.  
  576. If %KeepUncompressed%==2 Call :DeleteOriginal
  577.  
  578. If %MovieChange%==2 Call :CheckLocal
  579.  
  580.  
  581. GoTo :AdvancedExit
  582.  
  583. ::Advanced Rip With MKV
  584. :Advanced_Rip_With_MakeMKV
  585. If %TVLength2%==1 call :NoLimit
  586. If %TVLength2%==2 Call :10min
  587. If %TVLength2%==3 Call :20min
  588. If %TVLength2%==4 Call :30min
  589. If %TVLength2%==5 Call :45min
  590. If %TVLength2%==6 Call :60min
  591. makemkvcon64.exe --minlength=%RipMinSeconds2% mkv disc:%discNum% all "%RipDir%\%volid%"
  592. Echo %date% %time%: Rip complete [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  593. Goto :EOF
  594.  
  595.  
  596. :AdvancedTVHandbrake
  597. Mkdir "%TVEncodeDir%\%volid%"
  598. ::Call :EncodingSettings
  599. ::cd /d %ScriptPath%
  600. ::Set /p EncodingSettings=<value.txt
  601. ::del value.txt
  602. If %TVEncodingSettings%==1 Call :480Mediumm
  603. If %TVEncodingSettings%==2 Call :480High
  604. If %TVEncodingSettings%==3 Call :720pMedium
  605. If %TVEncodingSettings%==4 Call :720High
  606. If %TVEncodingSettings%==5 Call :1080pMedium
  607. If %TVEncodingSettings%==6 Call :1080pHigh
  608. Echo %date% %time%: BegIn HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  609. Cd /d "%Handbrakepath%"
  610. HandBrakeCLI -v0 -i "%RipDir%\%volid%" -o "%TVEncodeDir%\%volid%\%volid%.%RESOLUTION%.mkv" %PICTURE% %VIDEO% %AUDIO% %ADVANCED%
  611. ECHO %date% %time%: End HB Encode [%volid%] >> "%scriptpath%\AutoRipLog.txt"
  612.  
  613. Goto :EOF
  614.  
  615.  
  616. :CheckLocal
  617. If Exist "%RipDir%\%volid%\*.mkv" (
  618. Call :MoveChangeNameUnproccesed
  619. ) Else (
  620. Call :MoveChangedName
  621. )
  622. Goto :EOF
  623.  
  624.  
  625.  
  626. :MoveChangeNameUnproccesed
  627. cd /d "%RipDir%"
  628. Mkdir %Volid2%
  629. cd /d "%RipDir%\%volid2%"
  630. Mkdir "%Folder% %Season%"
  631. cd /d "%RipDir%\%volid%"
  632. Move "*.mkv" "%RipDir%\%volid2%\%Folder% %Season%"
  633. cd /d "%RipDir%"
  634. Del "%volid%"
  635. cd /d "%RipDir%\%volid2%\%Folder% %Season%"
  636. ren "*.mkv" "%volid2%.mkv"
  637.  
  638.  
  639.  
  640.  
  641.  
  642. :MoveChangedName
  643. cd /d "%TVEncodeDir%
  644. Mkdir "%TVEncodeDir%\%volid2%"
  645. cd /d "%TVEncodeDir%\%volid2%"
  646. Mkdir "%Folder% %Season%"
  647. cd /d "%TVEncodeDir%\%volid%"
  648. Move "*.mkv" "%TVEncodeDir%\%volid2%\%Folder% %Season%"
  649. cd /d "%TVEncodeDir%"
  650. Del "%volid%"
  651. cd /d "%TVEncodeDir%\%volid2%\%Folder% %Season%"
  652. ren "*.mkv" "%volid2%.%RESOLUTION%.mkv"
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  661. :: Change or add Handbrake Settings here :
  662. :: Format follows the tabs In handbrake, PICTURE settings include video filter as this is how it's referenced In the CLIGuide :
  663. :: For full explanations of settings, see here: https://trac.handbrake.fr/wiki/CLIGuide :
  664. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  665. :OriginalSettings
  666. Set RESOLUTION=720p
  667. Set PICTURE=--format mkv --width 1280
  668. Set VIDEO=-m -e x264 --quality 23
  669. Set AUDIO=--ab 64 --mixdown mono
  670. 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
  671. Goto :EOF
  672.  
  673. :1080pLow
  674. Set RESOLUTION=1080p
  675. Set PICTURE=-f mkv -w 1920 --height 1080 --loose-anamorphic
  676. Set VIDEO=-m -e x264 -q 20 -r 29.97 --pfr
  677. 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
  678. Set ADVANCED=--x264-profile high
  679. Goto :EOF
  680.  
  681. :1080pMedium
  682. Set RESOLUTION=1080p
  683. Set PICTURE=-f mkv --decomb -w 1920 --height 1080 --loose-anamorphic --modulus 2
  684. Set VIDEO=-m -e x264 -q 20 --vfr
  685. 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
  686. Set ADVANCED=-x b-adapt=2:rc-lookahead=50
  687. Goto :EOF
  688.  
  689. :1080pHigh
  690. Set RESOLUTION=1080p
  691. Set PICTURE=-f mkv --decomb -w 1920 --height 1080 --crop 0:0:0:0 --loose-anamorphic --modulus 2
  692. Set VIDEO=-m -e x264 -q 20 --vfr
  693. 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
  694. Set ADVANCED=-x b-adapt=2:rc-lookahead=50:ref=6:bframes=6:me=umh:subq=9:merange=64:analyse=all
  695. Goto :EOF
  696.  
  697. :720pLow
  698. Set RESOLUTION=720p
  699. Set PICTURE=-f mkv -w 1280 --loose-anamorphic
  700. Set VIDEO=-m -e x264 -q 20 -r 29.97 --pfr
  701. 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
  702. Set ADVANCED=--x264-profile high
  703. Goto :EOF
  704.  
  705. :720pMedium
  706. Set RESOLUTION=720p
  707. Set PICTURE=-f mkv --decomb -w 1280 --loose-anamorphic --modulus 2
  708. Set VIDEO=-m -e x264 -q 20 --vfr
  709. 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
  710. Set ADVANCED=-x b-adapt=2:rc-lookahead=50
  711. Goto :EOF
  712.  
  713. :720pHigh
  714. Set RESOLUTION=720p
  715. Set PICTURE=-f mkv --decomb -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2
  716. Set VIDEO=-m -e x264 -q 20 --vfr
  717. 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
  718. Set ADVANCED=-x b-adapt=2:rc-lookahead=50:ref=6:bframes=6:me=umh:subq=9:merange=64:analyse=all
  719. Goto :EOF
  720.  
  721. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  722. ::Tv Encoding
  723. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  724. :480Medium
  725. Set RESOLUTION=480p
  726. Set PICTURE=-f mkv --decomb -w 853 --loose-anamorphic --modulus 2
  727. Set VIDEO=-m -e x264 -q 20 --vfr
  728. 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
  729. Set ADVANCED=-x b-adapt=2:rc-lookahead=50
  730. Goto :EOF
  731.  
  732. :480High
  733. Set RESOLUTION=720p
  734. Set PICTURE=-f mkv --decomb -w 853 --crop 0:0:0:0 --loose-anamorphic --modulus 2
  735. Set VIDEO=-m -e x264 -q 20 --vfr
  736. 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
  737. Set ADVANCED=-x b-adapt=2:rc-lookahead=50:ref=6:bframes=6:me=umh:subq=9:merange=64:analyse=all
  738. Goto :EOF
  739.  
  740. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  741. :NoLimit
  742. Set RipMinSeconds2=0
  743. Goto :EOF
  744.  
  745. :10min
  746. Set RipMinSeconds2=600
  747. Goto :EOF
  748.  
  749. :20min
  750. Set RipMinSeconds2=1200
  751. Goto :EOF
  752.  
  753. :30min
  754. Set RipMinSeconds2=1800
  755. Goto :EOF
  756.  
  757. :45min
  758. Set RipMinSeconds2=2700
  759. Goto :EOF
  760.  
  761. :60min
  762. Set RipMinSeconds2=3600
  763. Goto :EOF
  764.  
  765. :::::::::::::::::::::::::::::
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement