2012-09-23, 06:30
Spinalcrack...that did it. Again...I can't thank you enough for the help!
@Echo offSetlocal enableextensions
::*********************************************************************************************
::*** AutoRipDVD is brought to you by Spinalcracker
::*********************************************************************************************
::
::*********************************************************************************************
::*** 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=D:
::------------------------------
::
::*** RipDir=Where you want your DVD ripped to ie. your xbmc movie folder *BE SURE TO INCLUDE TRAILING \
::
::------------------------------
Set RipDir=\\BLACKHOLE\video\nieuwe films\
::------------------------------
::
::*** IntDir=Where you installed MakeMKV to
::
::----------------------------------------
Set IntDir=C:\Program Files (x86)\MakeMKV\
::----------------------------------------
::
::*** ScriptPath=Where the files for this script are located with trailing "\" ie. Where AutoRipComplete.vbs & Beep.vbs are located *BE SURE TO INCLUDE TRAILING \
::
::------------------------------------
Set ScriptPath=C:\Program Files (x86)\AutoRipDVD\
::------------------------------------
::
::*** 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
::---------------------
::
::*** Using Handbrake to compress - Yes or No?
::
::------------------------------------
Set Handbrake=Yes
::------------------------------------
::
::*** Sets the install path to handbrake
::
::------------------------------------
Set Handbrakepath=C:\Program Files (x86)\Handbrake\
::------------------------------------
::
::*** Sets the level of compression in Handbrake so unless you really know what you are doing, do NOT adjust this next setting!
::
::------------------------------------
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
::------------------------------------
::
::*** Sets the format of the new compressed file, so again, unless you know what you are doing, please leave it as mkv!
::
::------------------------------------
Set FORMAT=--optimize --format mkv
::------------------------------------
::
::*** Sets the quality to something visually appealing but in a small files size - play with this if your outcome isn't to your liking
::
::------------------------------------
Set QUALITY=--ab 64 --mixdown mono --quality 23 -e x264 -x %X264%
::------------------------------------
::
::*** Sets the output to 720p resolution - change if you prefer something else
::
::------------------------------------
Set SIZE=--width 1280 --height 720
::------------------------------------
::
::*********************************************************************************************
::*********************************************************************************************
::******* DO NOT EDIT ANYTHING BELOW THIS!!!!!!************************************************
::*********************************************************************************************
::*********************************************************************************************
::For /f %%# In ('Mountvol^|Findstr [d-z]:\\') Do (
:: Fsutil fsinfo drivetype %%#|Find "CD-ROM">Nul&&(Set "CDROM=%%~d#"))
::If Not Defined CDROM call :NoDrive
for /f "tokens=1-5*" %%1 in ('vol %DriveLetter%') do (
set volid=%%6 & goto processcontd
)
:processcontd
set nospace=%volid%
echo [%nospace%]
echo.
for /f "tokens=* delims= " %%A in ('echo %nospace% ') do set nospace=%%A
set nospace=%nospace:~0,-1%
echo [%nospace%]
set volid=%nospace%
echo: %volid%
set str=%volid%
echo.%str%
set str=%str:_= %
echo.%str%
set volid=%str%
If "%volid%"=="_= " call :NoDrive
Echo:Ripping %volid% now...
mkdir "%RipDir%%volid%"
cd /d "%ScriptPath%"
OSDAutoRip.hta
cd /d "%IntDir%"
makemkvcon64.exe --minlength=%RipMinSeconds% mkv disc:0 all "%RipDir%%volid%"
SET _tmpPath="%RipDir%%volid%"
cd /d %_tmpPath%
for %%i in ("title*.mkv") do (set fname=%%i) & call :rename
If %Handbrake%==Yes call :HBEncode
cd /d "%ScriptPath%"
AutoRipComplete.vbs
cscript Beep.vbs
exit
:NoDrive
cd /d "%ScriptPath%"
cscript Beep.vbs
NoDiskDrive.hta
AutoRipComplete.vbs
exit
:HBEncode
cd /d "%Handbrakepath%"
HandBrakeCLI -v0 -i "%RipDir%%volid%" -o "%RipDir%%volid%\%volid% 720p.mkv" %FORMAT% %QUALITY% %SIZE%
cd /d %_tmpPath%
del "%volid%_*.mkv"
:rename
::Cuts off 1st 5 characters of fname, then appends prefix
ren %fname% "%volid%"_%fname:~5%
If %Handbrake%==Yes call :HBEncode
::------------------------------------
::
::*** Update XBMC Library Upon completion?
::*** NOTE: CURL for Windows MUST BE INSTALLED
:: http://curl.haxx.se/download.html
::
::------------------------------------
set UpdateXBMC=Yes
::------------------------------------
::
::*** Which version of XBMC are you using? Enter Frodo or Eden
::
::------------------------------------
set XBMCversion=Frodo
:: Set login details for XBMC HTTP access
set XBMCuser=xbmc
set XBMCpass=xbmc
set XBMCurl=127.0.0.1
set XBMCport=8082
set cURLpath=C:\cURL\curl.exe
:EndingScripts
If %Handbrake%==Yes call :HBEncode
If %UpdateXBMC%==Yes call :UpdateLibrary
:ScriptComplete
cd /d "%ScriptPath%"
AutoRipComplete.vbs
cscript Beep.vbs
exit
:NoDrive
cd /d "%ScriptPath%"
cscript Beep.vbs
NoDiskDrive.hta
AutoRipComplete.vbs
exit
:HBEncode
cd /d "%Handbrakepath%"
HandBrakeCLI -v0 -i "%RipDir%%volid%" -o "%RipDir%%volid%\%volid% 720p.mkv" %FORMAT% %QUALITY% %SIZE%
cd /d %_tmpPath%
del "%volid%_*.mkv"
SET Handbrake=NULL
Goto :EndingScripts
:rename
::Cuts off 1st 5 characters of fname, then appends prefix
ren %fname% "%volid%"_%fname:~5%
Goto :EndingScripts
:UpdateLibrary
If XBMCversion==Frodo set updateCall=%cURLpath% -i -H "Content-Type: application/json" -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\"}" http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/jsonrpc
If XMBCversion==Eden set updateCall=%cURLpath% --get "http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)"
call %updateCall%
SET UpdateXBMC=NULL
Goto :EndingScripts
:GetDiscNum
::Get disc number based on name of %volid%
"%IntDir%\makemkvcon64.exe" -r --cache=1 info disc:9999 | find /i "%volid%" > "%userprofile%\ARtemp"
type "%userprofile%\ARtemp"
set /p discNum=<"%userprofile%\ARtemp"
del "%userprofile%\ARtemp"
set discNum=%discNum:~4,1%
cd /d "%IntDir%"
makemkvcon64.exe --minlength=%RipMinSeconds% mkv disc:%discNum% all "%RipDir%%volid%"