Advertisement
Guest User

Untitled

a guest
Nov 1st, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. @Echo off
  2. Setlocal enableextensions
  3. ::*********************************************************************************************
  4. ::*** AutoRipDVD is brought to you by Spinalcracker
  5. ::*********************************************************************************************
  6. ::
  7. ::*********************************************************************************************
  8. ::*** Change the following variables to match your setup
  9. ::*********************************************************************************************
  10. ::
  11. ::*** DriveLetter=The drive letter of your DVD or Blu-Ray drive ie. D: or G: etc
  12. ::
  13. ::------------------------------
  14. Set DriveLetter=E:
  15. ::------------------------------
  16. ::
  17. ::*** RipDir=Where you want your DVD ripped to ie. your xbmc movie folder *BE SURE TO INCLUDE TRAILING \
  18. ::
  19. ::------------------------------
  20. Set RipDir=I:\HD Movies\
  21. ::------------------------------
  22. ::
  23. ::*** IntDir=Where you installed MakeMKV to
  24. ::
  25. ::----------------------------------------
  26. Set IntDir=C:\Program Files (x86)\MakeMKV
  27. ::----------------------------------------
  28. ::
  29. ::*** ScriptPath is now dynamically hardcoded to wherever the LaunchAutoRipDVD.exe, script will break if you move location of this exe file
  30. ::
  31. ::------------------------------------
  32. Set ScriptPath=%~dp0
  33. ::------------------------------------
  34. ::
  35. ::*** RipMinSeconds=Minimum time in seconds that should be ripped off disk to avoid getting previews etc. Default is 3600 seconds or 1 hour
  36. ::
  37. ::---------------------
  38. Set RipMinSeconds=3600
  39. ::---------------------
  40. ::
  41. ::*** Using Handbrake to compress - Yes or No?
  42. ::
  43. ::------------------------------------
  44. Set Handbrake=No
  45. ::------------------------------------
  46. ::
  47. ::*** Sets the install path to handbrake
  48. ::
  49. ::------------------------------------
  50. Set Handbrakepath=C:\Program Files (x86)\Handbrake\
  51. ::------------------------------------
  52. ::
  53. ::*** Sets the level of compression in Handbrake so unless you really know what you are doing, do NOT adjust this next setting!
  54. ::
  55. ::------------------------------------
  56. Set X264=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
  57. ::------------------------------------
  58. ::
  59. ::*** Sets the format of the new compressed file, so again, unless you know what you are doing, please leave it as mkv!
  60. ::
  61. ::------------------------------------
  62. Set FORMAT=--optimize --format mkv
  63. ::------------------------------------
  64. ::
  65. ::*** Sets the quality to something visually appealing but in a small files size - play with this if your outcome isn't to your liking
  66. ::
  67. ::------------------------------------
  68. Set QUALITY=--ab 64 --mixdown mono --quality 23 -e x264 -x %X264%
  69. ::------------------------------------
  70. ::
  71. ::*** Sets the output to 720p resolution - change if you prefer something else
  72. ::
  73. ::------------------------------------
  74. Set SIZE=--width 1280 --height 720
  75. ::------------------------------------
  76. ::------------------------------------
  77. ::
  78. ::*** Update XBMC Library Upon completion?
  79. ::*** NOTE: CURL for Windows MUST BE INSTALLED
  80. :: http://curl.haxx.se/download.html
  81. ::
  82. ::------------------------------------
  83. set UpdateXBMC=Yes
  84. ::------------------------------------
  85. ::
  86. ::*** Which version of XBMC are you using? Enter Frodo or Eden
  87. ::
  88. ::------------------------------------
  89. set XBMCversion=Frodo
  90. :: Set login details for XBMC HTTP access
  91. set XBMCuser=xbmc
  92. set XBMCpass=xbmc
  93. set XBMCurl=127.0.0.1
  94. set XBMCport=8082
  95. set cURLpath=C:\cURL\curl.exe
  96. ::
  97. ::*********************************************************************************************
  98. ::*********************************************************************************************
  99. ::******* DO NOT EDIT ANYTHING BELOW THIS!!!!!!************************************************
  100. ::*********************************************************************************************
  101. ::*********************************************************************************************
  102.  
  103.  
  104. ::For /f %%# In ('Mountvol^|Findstr [d-z]:\\') Do (
  105. :: Fsutil fsinfo drivetype %%#|Find "CD-ROM">Nul&&(Set "CDROM=%%~d#"))
  106. ::If Not Defined CDROM call :NoDrive
  107.  
  108.  
  109. for /f "tokens=1-5*" %%1 in ('vol %DriveLetter%') do ( set volid=%%6 & goto processcontd)
  110.  
  111. :processcontd
  112. set nospace=%volid%
  113. echo [%nospace%]
  114. echo.
  115. for /f "tokens=* delims= " %%A in ('echo %nospace% ') do set nospace=%%A
  116. set nospace=%nospace:~0,-1%
  117. echo [%nospace%]
  118. set volid=%nospace%
  119. echo: %volid%
  120.  
  121. :GetDiscNum
  122. ::Get disc number based on name of %volid%
  123. "%IntDir%\makemkvcon64.exe" -r --cache=1 info disc:9999 | find /i "%volid%" > "%userprofile%\ARtemp"
  124. type "%userprofile%\ARtemp"
  125. set /p discNum=<"%userprofile%\ARtemp"
  126. del "%userprofile%\ARtemp"
  127. set discNum=%discNum:~4,1%
  128.  
  129. set str=%volid%
  130. echo.%str%
  131. set str=%str:_= %
  132. echo.%str%
  133. set volid=%str%
  134. If "%volid%"=="_= " call :NoDrive
  135.  
  136. Echo:Ripping %volid% now...
  137.  
  138. mkdir "%RipDir%%volid%"
  139.  
  140. cd /d "%ScriptPath%"
  141. OSDAutoRip.hta
  142.  
  143. cd /d "%IntDir%"
  144. makemkvcon64.exe --minlength=%RipMinSeconds% mkv disc:%discNum% all "%RipDir%%volid%"
  145.  
  146. SET _tmpPath="%RipDir%%volid%"
  147. cd /d %_tmpPath%
  148. for %%i in ("title*.mkv") do (set fname=%%i) & call :rename
  149.  
  150. :EndingScripts
  151. If %Handbrake%==Yes call :HBEncode
  152. If %UpdateXBMC%==Yes call :UpdateLibrary
  153.  
  154. :ScriptComplete
  155. cd /d "%ScriptPath%"
  156. AutoRipComplete.vbs
  157. cscript Beep.vbs
  158. exit
  159.  
  160. :NoDrive
  161. cd /d "%ScriptPath%"
  162. cscript Beep.vbs
  163. NoDiskDrive.hta
  164. AutoRipComplete.vbs
  165. exit
  166.  
  167. :HBEncode
  168. cd /d "%Handbrakepath%"
  169. HandBrakeCLI -v0 -i "%RipDir%%volid%" -o "%RipDir%%volid%\%volid% 720p.mkv" %FORMAT% %QUALITY% %SIZE%
  170. cd /d %_tmpPath%
  171. del "%volid%_*.mkv"
  172. SET Handbrake=NULL
  173. Goto :EndingScripts
  174.  
  175. :rename
  176. ::Cuts off 1st 5 characters of fname, then appends prefix
  177. ren %fname% "%volid%"_%fname:~5%
  178. Goto :EndingScripts
  179.  
  180. :UpdateLibrary
  181. If %XBMCversion%==Frodo GOTO :UpdateLibraryFrodo
  182. If %XBMCversion%==Eden GOTO :UpdateLibraryEden
  183. GOTO :EndingScripts
  184.  
  185. :UpdateLibraryFrodo
  186. "%cURLpath%" -i -H "Content-Type: application/json" -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\"}" http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/jsonrpc
  187. Goto :EndLibraryUpdate
  188.  
  189. :UpdateLibraryEden
  190. "%cURLpath%" --get "http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
  191. Goto :EndLibraryUpdate
  192.  
  193. :EndLibraryUpdate
  194. SET UpdateXBMC=NULL
  195. cd /d "%ScriptPath%"
  196. Goto :EndingScripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement