Automation

Everything related to MakeMKV
Post Reply
nickdunc
Posts: 7
Joined: Wed Oct 14, 2015 8:58 am

Automation

Post by nickdunc » Wed Oct 14, 2015 9:09 am

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?

ndjamena
Posts: 830
Joined: Mon Jan 07, 2013 12:23 am

Re: Automation

Post by ndjamena » Wed Oct 14, 2015 11:05 am

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.
Last edited by ndjamena on Fri Oct 16, 2015 1:29 pm, edited 5 times in total.

nickdunc
Posts: 7
Joined: Wed Oct 14, 2015 8:58 am

Re: Automation

Post by nickdunc » Wed Oct 14, 2015 1:30 pm

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

ndjamena
Posts: 830
Joined: Mon Jan 07, 2013 12:23 am

Re: Automation

Post by ndjamena » Wed Oct 14, 2015 2:14 pm

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.

Quafi
Posts: 1
Joined: Sat Nov 24, 2018 7:49 am

Re: Automation

Post by Quafi » Wed May 01, 2019 2:42 pm

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!

Post Reply