Page 1 of 1

Automation

Posted: Wed Oct 14, 2015 9:09 am
by nickdunc
Hi,
As I have about 800 DVD's to rip I am looking to streamline the process as much as I can.
Is there a way with Make MKV to get it to watch a drive, and when a disk is inserted begin the rip, to a template set of preferences, and then spit the disk out when it is complete.
This would be great!
p.s. ripping main film is a nice feature, is this supported?

Re: Automation

Posted: Wed Oct 14, 2015 11:05 am
by ndjamena
Here we go, automation:

Rip.bat

Code: Select all

@echo off & TITLE Auto-MakeMKV Script
goto :SKIP
:PROCESS

	echo "%MakeMKVDir%\makemkvcon%ARCH%.exe" "--noscan" "--messages=-stdout" "--progress=-stderr" --debug="%OutputDir%\Disc%Count%\log.log" "--profile=%Profile%" "--minlength=%MinLength%" "mkv" "disc:%DriveNum%"  "%Title%" "%OutputDir%\Disc%Count%
	("%MakeMKVDir%\makemkvcon%ARCH%.exe" "--noscan" "--messages=-stdout" "--progress=-stderr" --debug="%OutputDir%\Disc%Count%\log.log" "--profile=%Profile%" "--minlength=%MinLength%" "mkv" "disc:%DriveNum%"  "%Title%" "%OutputDir%\Disc%Count%" | SplitPipe "%OutputDir%\Disc%Count%\log.txt") || ( echo Rip failed! & pause & goto :eof )
	cscript //nologo //I "%~dp0eject.vbs" "%DriveNum%"
	timeout ^1 >NUL & Set "Waiting="
	
goto :PRE
	
:SKIP

Set "Title=all"
Set /p "MinLength=Enter Minimum Length (default 1200 secs): "
if NOT defined MinLength Set "Minlength=1200"
Set /p "Drive=Enter Drive Letter: "
for /f "tokens=1,2 delims= " %%g in ('cscript //nologo //I "%~dp0eject.vbs" I %Drive%') do (
	set "Drive=%%g"
	set "DriveNum=%%h"
)
if NOT defined DriveNum (
	echo ERROR: DRIVE NOT FOUND.
	pause
	goto :eof
)
echo Source Drive: %DriveNum% ^[%Drive%:^\^]

:OutputDir_Loop
	Set /p "OutputDir=Enter Output Path: "
	if NOT defined OutputDir goto :OutputDir_Loop

Set "OutputDir=%OutputDir:"=%"
echo Destination Directory:
echo      %OutputDir%

if NOT exist "%OutputDir%" mkdir "%OutputDir%"

TITLE Auto-MakeMKV Script ^[%Drive%:^\^] - %OutputDir% ^(%DriveNum%^)

Set "Profile=C:\Program Files (x86)\MakeMKV\pcm-flac.mmcp.xml"

if EXIST "C:\Program Files (x86)\MakeMKV" ( Set "MakeMKVDir=C:\Program Files (x86)\MakeMKV" ) else ( if EXIST "C:\Program Files\MakeMKV" ( Set "MakeMKVDir=C:\Program Files\MakeMKV" ) else ( echo MakeMKV Folder NOT found. & pause & goto :eof ) )
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( Set "ARCH=64" ) else ( Set "ARCH=" )

Set "Count=0" & Set "Waiting="

:PRE
	cls

:START
	dir %Drive%:\ 1>nul 2>nul || ( ( if NOT defined Waiting ( echo Insert Disc in drive #%DriveNum% ^[%Drive%:\^]. & Set "Waiting=1" ) ) & timeout ^1 >NUL & goto :START )

:FOLDER
	if NOT exist "%OutputDir%\Disc%Count%" ( mkdir "%OutputDir%\Disc%Count%" ) else ( ( Set /a "Count+=1" ) & ( goto :FOLDER ) )

goto :PROCESS


eject.vbs

Code: Select all

if (WScript.Arguments.Count=0) Then
	WScript.Quit()
End If

Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
if (UCase(WScript.Arguments(0))="I") Then
	for i = 0 to colCDROMs.Count - 1
		if (colCDROMs.Item(i).driveSpecifier=(UCase(WScript.Arguments(1))+":")) Then
			WScript.echo UCase(WScript.Arguments(1)), " ", i 
		End If
	Next
elseif (UCase(WScript.Arguments(0))="D") Then
	if IsNumeric(WScript.Arguments(1)) Then
		if ABS(CInt(WScript.Arguments(1))) < colCDROMs.Count Then
			WScript.echo(Left(colCDROMs.Item(WScript.Arguments(1)).driveSpecifier,1))
		End If
	end if
elseif (UCase(WScript.Arguments(0))="C") Then
	WScript.echo(colCDROMs.Count)
elseif (UCase(WScript.Arguments(0))="L") Then
	for i = 0 to colCDROMs.Count - 1
		WScript.echo(Left(colCDROMs.Item(i).driveSpecifier,1))
	Next
else
	if IsNumeric(WScript.Arguments(0)) Then
		colCDROMs.Item(WScript.Arguments(0)).eject
	End If
End If
oWMP.close
Or use a more appropriate scripting language.

Re: Automation

Posted: Wed Oct 14, 2015 1:30 pm
by nickdunc
Hi,
Many thanks.
Sorry to be dumb but what do I do with this?
I'm literate but not a programmer. If there is a little guidance that would help a lot.
All the best,
Nick

Re: Automation

Posted: Wed Oct 14, 2015 2:14 pm
by ndjamena
I'm only half serious but it WILL work.

Assuming you're using windows copy the first set of code into notepad and save it as "Rip.bat", then copy the second set into notepad and save it as "eject.vbs" in the same directory.

Edit the variables in Rip.bat to match your preferences:

Title should probably be set to "all".
MinLength is whatever the hell you want, I use 1200 which is about 20 minutes.
Drive is the drive letter of your DVD drive, the old standard was "D"
DriveNum is the order of the drive you want starting at zero. If you have a single DVD drive then it should be zero ('0').
OutputDir is where you want the rips saved.
Profile is the path to the profile file you want to use.

If you want to know about profiles you look here:
http://www.makemkv.com/forum2/viewtopic.php?f=10&t=4385
http://www.makemkv.com/forum2/viewtopic.php?f=10&t=4386
http://www.makemkv.com/forum2/viewtopic.php?f=10&t=4566

and of course here:
http://www.makemkv.com/forum2/viewtopic ... 177#p34177
http://www.makemkv.com/forum2/viewtopic.php?f=10&t=5749

the default profiles are in the makemkv directory.

If your PC layout is non-standard you'll have to do some more fiddling to get it working.

After that you just double click "rip.bat" and you're on your way.

It's just A way, but at least it works.

Re: Automation

Posted: Wed May 01, 2019 2:42 pm
by Quafi
Hey there,
I know, old topic, anyways.
Whenever I'm running this script, at the point where I'm supposed to insert the disc, as soon as I've done that, the program just closes.
Literally nothing happens.
I suppose that's because this script is from 2015 and many MakeMKV versions aswell as Windows Updates have come past, but it would be great if this could be done again. I unfortunatly don't have the knowledge to accomplish that by myself.
Greetings!

Re: Automation

Posted: Fri Apr 10, 2020 7:50 am
by BluDay
Just bumping up the last question.

Is there an update?

Also, how could that script be used in a Mac environment?

Thanks for help and pointers.

Re: Automation

Posted: Mon Dec 28, 2020 5:08 am
by manbearpig
I was also having the script close without explanation. I made these changes to Rip.bat and it works for me on Windows 10. No changes to eject.vbs, that works as-is. Thanks to the original author...scripting this is a big time saver, even for a modest number of discs.

Change #1: removed this completely from both locations (one was for the echo, the other was for the execution). I did not find --profile as an option in the current documentation, and I just use the default config anyway. Not sure what to do if you want to use something other than the default.

Code: Select all

"--profile=%Profile%"
Change #2: replaced

Code: Select all

| SplitPipe
with

Code: Select all

>
Complete updated Rip.bat is as follows. Caveat: I'm a total newbie to bat scripting so while this works there is perhaps a better way to do it.

Code: Select all

@echo off & TITLE Auto-MakeMKV Script
goto :SKIP
:PROCESS

	echo "%MakeMKVDir%\makemkvcon%ARCH%.exe" "--noscan" "--messages=-stdout" "--progress=-stderr" --debug="%OutputDir%\Disc%Count%\log.log" "--minlength=%MinLength%" "mkv" "disc:%DriveNum%"  "%Title%" "%OutputDir%\Disc%Count%
	("%MakeMKVDir%\makemkvcon%ARCH%.exe" "--noscan" "--messages=-stdout" "--progress=-stderr" --debug="%OutputDir%\Disc%Count%\log.log" "--minlength=%MinLength%" "mkv" "disc:%DriveNum%"  "%Title%" "%OutputDir%\Disc%Count%" > "%OutputDir%\Disc%Count%\log.txt") || ( echo Rip failed! & pause & goto :eof )
	cscript //nologo //I "%~dp0eject.vbs" "%DriveNum%"
	timeout ^1 >NUL & Set "Waiting="
	
goto :PRE
	
:SKIP

Set "Title=all"
Set /p "MinLength=Enter Minimum Length (default 1200 secs): "
if NOT defined MinLength Set "Minlength=1200"
Set /p "Drive=Enter Drive Letter: "
for /f "tokens=1,2 delims= " %%g in ('cscript //nologo //I "%~dp0eject.vbs" I %Drive%') do (
	set "Drive=%%g"
	set "DriveNum=%%h"
)
if NOT defined DriveNum (
	echo ERROR: DRIVE NOT FOUND.
	pause
	goto :eof
)
echo Source Drive: %DriveNum% ^[%Drive%:^\^]

:OutputDir_Loop
	Set /p "OutputDir=Enter Output Path: "
	if NOT defined OutputDir goto :OutputDir_Loop

Set "OutputDir=%OutputDir:"=%"
echo Destination Directory:
echo      %OutputDir%

if NOT exist "%OutputDir%" mkdir "%OutputDir%"

TITLE Auto-MakeMKV Script ^[%Drive%:^\^] - %OutputDir% ^(%DriveNum%^)

Set "Profile=C:\Program Files (x86)\MakeMKV\pcm-flac.mmcp.xml"

if EXIST "C:\Program Files (x86)\MakeMKV" ( Set "MakeMKVDir=C:\Program Files (x86)\MakeMKV" ) else ( if EXIST "C:\Program Files\MakeMKV" ( Set "MakeMKVDir=C:\Program Files\MakeMKV" ) else ( echo MakeMKV Folder NOT found. & pause & goto :eof ) )
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( Set "ARCH=64" ) else ( Set "ARCH=" )

Set "Count=0" & Set "Waiting="

:PRE
	cls

:START
	dir %Drive%:\ 1>nul 2>nul || ( ( if NOT defined Waiting ( echo Insert Disc in drive #%DriveNum% ^[%Drive%:\^]. & Set "Waiting=1" ) ) & timeout ^1 >NUL & goto :START )

:FOLDER
	if NOT exist "%OutputDir%\Disc%Count%" ( mkdir "%OutputDir%\Disc%Count%" ) else ( ( Set /a "Count+=1" ) & ( goto :FOLDER ) )

goto :PROCESS


Re: Automation

Posted: Thu Dec 31, 2020 12:03 pm
by bergerb
Hi,

Thanks for the scripts!

To add to the collection:
I made a small script that checks if the drive is available and plays a sound when it is not.
So you will get alerts, when the ripping finished.
Just save this as alert.bat and open it as well as the Rip.bat.
Adjust the Drive-Letter to your CD/DVD/BD drive.

Code: Select all

@echo off

:Start
ping localhost -n 2 > nul
dir d:\ 1>nul 2>nul && goto Start

echo Disk Not Found

REM Play sound 
powershell -c echo `a

goto Start

Re: Automation

Posted: Fri Dec 03, 2021 1:56 am
by BrandyRock.SmartHome
Running a couple minor issues with this script - not sure if someone can help. I know this thread is pretty old...

1. Like the OP, I'm going through a big library, and I'm not always sitting at my computer. Im running into an issue where after 3(ish) minutes, my DVD drive will automatically close after ejecting and run the movie again.
2. Seems random, like an additional pause is needed somewhere, but the DVD name stops being added to the file name after a few rips. The title ends up being a default of "title_<t##>.mkv"
example: I'm getting title_00.mkv instead of FIGHTCLUB_t00.mkv

Appreciate any help out there! This script has already been so useful.

-A