Page 1 of 1

Feature request - file naming

Posted: Tue Apr 29, 2014 3:38 am
by nohuhu
I've been using MakeMKV for some time now, and been wondering if it would be hard to add an option to make the file name default to the title name instead of how it's been done now? Or alternatively, not replace spaces with underscores and avoid adding _txx at the end? Updating it manually gets old real quick... :)

Re: Feature request - file naming

Posted: Tue Apr 29, 2014 7:07 am
by Dazkine
Try filebot

Re: Feature request - file naming

Posted: Tue Apr 29, 2014 8:29 am
by ndjamena
The wonders of batch!

Save this as "Unmake.bat" and put it in your main rip folder or the SendTo Folder (Assuming you're using windows)

Code: Select all

@if "%EMode%"=="" Set EMode=OFF
@ECHO %EMode%
SetLocal DisableDelayedExpansion

Set "EXTLIST=*.mkv"
Set "DoPop="

if [%1]==[] (
	Set "Pattern=%EXTLIST%"
	CALL :START %1
)

:ARGS

	if [%1]==[] (
		EndLocal
		pause
		goto :eof
	)
	if NOT EXIST %1 (
		SHIFT
		goto :ARGS
	)
	Set "Pattern=%EXTLIST%"
	if "%~f1"=="%CD%" (
		CALL :START %1
		SHIFT
		goto :ARGS
	)
	Type NUL
	pushd "%~f1" 2> nul
	if NOT "%errorlevel%"=="0" (
		if NOT "%CD%\"=="%~dp1" (
			pushd "%~dp1"
			Set "DoPop=1"
		)
		Set Pattern="%~nx1"
	) else (
		Set "DoPop=1"
	)
	CALL :START %1
	if "%DoPop%"=="1" (
		popd
		Set "DoPop="
	)
	SHIFT

goto :ARGS

:START

	Set "Count=0"
	for %%y in (%Pattern%) do (
		CALL :Process_File "%%~fy"
	)
	if "%Count%"=="0" (
		for /d %%b in (*) do (
			pushd "%%~fb"
			CALL :START "%%~fb"
			popd
		)
	)

goto :eof

:Process_File

	Set /a Count+=1
	
	SetLocal DisableDelayedExpansion
	echo Processing; "%~nx1"
	Set "Work=%~n1"
	if "%Work:~-4,1%"=="_" if "%Work:~-3,1%"=="t" (
		Set "Work=%Work:~0,-4%"
	)
	Set "Work=%Work:_= %"
	if NOT "%~n1"=="%Work%" (
		echo Renaming "%~nx1" to "%Work%%~x1"
		ren "%~f1" "%Work%%~x1"
	)
	EndLocal

goto :eof
Failing that, MediaCenterMaster will just read through all the junk MakeMKV adds and rename the files properly.

Re: Feature request - file naming

Posted: Wed Apr 30, 2014 4:50 pm
by nohuhu
@ndjamena,

Thanks, that script looks nifty. I didn't even know you can do things like that with Windows bat files. :) It's been a long time since I used Windows...

Having said that, I do think that the problem is better fixed at the core - and should be an easy fix, too. Come to think of it, maybe the fact that I'm a paying customer would lend some credibility to my tiny feature request? ;)

Re: Feature request - file naming

Posted: Wed Apr 30, 2014 9:19 pm
by ndjamena
Batch is a bit old and outdated, I would be using Powershell, except setting up Drag-and-Drop for Powershell scripts is a pain. I'm sure whatever OS you're using has some equivalent of batch, or else there must be some kind of scripting/programming software you can download. Actually, if I downloaded a proper renaming application I could cut my batch script down to almost nothing, but then if I reinstalled windows I'd have to download the thing again. Google 'batch rename' and you'll get masses of options, but yes, we've all been asking for better file names for a while and nothing's happened yet, maybe one day...

Re: Feature request - file naming

Posted: Thu May 01, 2014 12:54 pm
by ndjamena

Re: Feature request - file naming

Posted: Sun May 04, 2014 8:46 pm
by nohuhu
@ndjamena,

Thanks for the tips; I see what you're saying. I can write a script for renaming files, no problem with that. However that would be a work around, not a true solution. Being a software dev I realize that replacing spaces with underscores like MakeMKV does is actually *more* work than just leaving the title alone - which is what I'm requesting. ;)

Re: Feature request - file naming

Posted: Sun May 04, 2014 9:39 pm
by ndjamena
Agreed, but people have been asking for this for years now and nothing has been done about it. I'm giving you an easier alternative to 'manual' renaming.

I believe the 'tXX' is added to ensure unique file names, I've already mentioned in another thread that if you edit a 'name' directly it's not necessary, but it's MakeMKV's default behaviour and Mike would have to write in an exception for it to do otherwise under certain conditions. The purpose of replacing spaces with underscores is obvious, whether it's necessary is another matter. This is an old topic, and Mike might choose to act on it one day, until then...