Custom command failing

I’m not sure what triggered this, and OS update or an MCEB update, but in build .7 and .8 converted files are no longer being moved to my network drive.

This has been working for years, so I’m not sure what I did to mess things up.

As usual I have updated the service with an administrator account user. I’ve also tried adding same user to the Network Authentication settings in the UI under settings.

I noticed this in the conversion log, but I don’t understand why as there are no Illegal characters in the path.

E:\VideoCaptures\Cleaned Files\Zoo Drop It Like Its Hot s03 e05 07-27-2017.ts

INFORMATION> 2017-07-28T16:15:09 MCEBuddy.Engine.ConversionJob → Running custom commands
→ Custom Renaming Command → %showname% %episodename% s%season%## e%episode%## %airmonth%-%airday%-%airyear% %rating%
WARNING> → Cannot find Parental Rating
2017-07-28T16:15:09 MCEBuddy.Transcode.CustomCommand → Custom command parameters read →
PostCustomCommandPath = “e:\videocaptures\cleaned files\mcebpostprocess.bat”
PostCustomCommandParameters = “%convertedfile%” %sourcefile% “%destinationpath%” 1080 .%convertedext% 0 %airmonth% %airday% %airyear% %season%##
PostCustomCommandHangPeriod = 0
PostCustomCommandCritical = False
PostCustomCommandUISession = False
PostCustomCommandShowWindow = True
PostCustomCommandExitCodeCheck = False
ERROR> 2017-07-28T16:15:09 MCEBuddy.Engine.ConversionJob → Unhanded error during conversion, conversion cancelled
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.IsPathRooted(String path)
at MCEBuddy.Transcode.CustomCommand.Run()
at MCEBuddy.Engine.ConversionJob.Convert()
INFORMATION> 2017-07-28T16:15:09 MCEBuddy.Engine.ConversionJob →
→ Performance Metrics for the Current Conversion

I uploaded the both logs to the FTP server.

That’s because your custom command is generating an invalid command:

PostCustomCommandPath = “e:\videocaptures\cleaned files\mcebpostprocess.bat”
PostCustomCommandParameters = “%convertedfile%” %sourcefile% “%destinationpath%” 1080 .%convertedext% 0 %airmonth% %airday% %airyear% %season%##
PostCustomCommandHangPeriod = 0
PostCustomCommandCritical = False
PostCustomCommandUISession = False
PostCustomCommandShowWindow = True
PostCustomCommandExitCodeCheck = False
ERROR> 2017-07-28T16:15:09 MCEBuddy.Engine.ConversionJob → Unhanded error during conversion, conversion cancelled
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.IsPathRooted(String path)
at MCEBuddy.Transcode.CustomCommand.Run()
at MCEBuddy.Engine.ConversionJob.Convert()

Your custom command is generating invalid path characters for your command batch file.

Hmmmm Did something change in build .7 (.8), or did I screw something up? (I didn’t knowingly make any changes) I’ve looked though my systems backup’s went back 30 days and I don’t see any changes in anything below.

Here is the command string as presented in the profile

PostCustomCommandPath=“E:\VideoCaptures\Cleaned Files\MCEBPostProcess.bat”
PostCustomCommandParameters=“%convertedfile%” %sourcefile% “%destinationpath%” 1080 .%convertedext% 0 %airmonth% %airday% %airyear% %season%##
PostCustomCommandHangPeriod=0
PostCustomCommandCritical=false

Here is the called .bat file:

@ECHO OFF

setlocal EnableDelayedExpansion

SET BatFile=“E:\VideoCaptures\Cleaned Files\TVTransfer.bat”
SET OutputFileName=“%~n1”
SET InputFileName=“%~n2”
SET FolderOutput=“%~3”
SET WideoWidth=“%~4”
SET OutputExtension=“%~5”
SET OutputFileSize=“%~z1”
SET OADMonth=“%~7”
SET OADDay=“%~8”
SET OADYear=“%~9”
SHIFT /4
SET SEASON=%~9
Call %BatFile% %OutputFileName% %InputFileName% %FolderOutput% %WideoWidth% %OutputExtension% %OutputFileSize% %OADMonth% %OADDay% %OADYear% %SEASON%

Here is the .bat file where all the work is done.

@ECHO ON
setlocal EnableDelayedExpansion

SET sPAT=“\SERVER\Recorded TV\Other Shows”
SET OUTPUT_NAME=“%~1”
SET INPUT_NAME=%~2
SET OUTPUT_FOLDER=%~3
SET VIEDO_WIDTH=%~4
SET OUTPUT_Ext=%~5
SET OUTPUT_FILE_SIZE_MB=%~6
SET OAD_MONTH=%~7
SET OAD_DAY=%~8
SET OAD_YEAR=%~9
SHIFT /4
SET SEASON=%~9
SET SEARCHNAME=

If “%OAD_MONTH%” == “” (
SET OAD_MONTH=NA
)
If “%OAD_DAY%” == “” (
SET OAD_MONTH=NA
)
If “%OAD_YEAR%” == “” (
SET OAD_MONTH=NA
)
If “%SEASON%” == “” (
SET SEASON=NA
)

echo.%OAD_MONTH%
echo.%OUTPUT_FILE_SIZE_MB%

::Todays Date
FOR %%A IN (%Date%) DO (
FOR /F “tokens=1-3 delims=/-” %%B in (“%%~A”) DO (
SET MMDDYYYY=%%B-%%C-%%D
)
)

If %OAD_MONTH% NEQ NA (
SET MMDDYYYY=%OAD_MONTH%-%OAD_DAY%-%OAD_YEAR%
)

echo.%MMDDYYYY%

:: Only procc. the video files, otherwise just delete
If %OUTPUT_FILE_SIZE_MB% LEQ 200000000 (
DEL /q “%OUTPUT_FOLDER%%~1%OUTPUT_Ext%”
EXIT
)

::Remove any Spaces from Search Name
set HAYSTACK=%INPUT_NAME%
set HAYSTACK=%HAYSTACK: =%

echo.%HAYSTACK%

:: Grab the string before the first “-”.
for /f “delims=-” %%i in (“%HAYSTACK%”) do set string=%%i
SET SEARCHNAME=%string%

echo.%SEARCHNAME%

:: Get the Show Params
for /f “tokens=2-3 delims=;” %%A in (‘findstr /b /i “%SEARCHNAME%” “C:\FTPSyncFiles\Bat Files\SHOWPARMS.txt”’) do (

SET sPAT=%%A
)

echo This is the program path %sPAT%

:: Copy to the Server
If %sPAT% NEQ “” (

IF %SEASON% NEQ NA (
:: Check to see if Dir exist already
if NOT EXIST %sPAT%\SEASON-%SEASON% (
MD %sPAT%\SEASON-%SEASON%
)
:: Removed the use of OUTPUT_NAME becuase of special charictors and used %~1 (Which removes the quotes) instead
START “MCE Move” /b cmd /c move /y “%OUTPUT_FOLDER%%~1%OUTPUT_Ext%” %sPAT%\SEASON-%SEASON%
:: Update the root directory with the current date using Touch.exe
touch -m %sPAT%
) ELSE (
:: Check to see if Dir exist already
if NOT EXIST %sPAT%%MMDDYYYY% (
MD %sPAT%%MMDDYYYY%
)
:: Removed the use of OUTPUT_NAME becuase of special charictors and used %~1 (Which removes the quotes) instead
START “MCE Move” /b cmd /c move /y “%OUTPUT_FOLDER%%~1%OUTPUT_Ext%” %sPAT%%MMDDYYYY%
:: Update the root directory with the current date using Touch.exe
touch -m %sPAT%
)

:: Delete the .properties files if present
DEL /q “E:\VideoCaptures\QSF%INPUT_NAME%.ts.properties”
DEL /q “E:\VideoCaptures\QSF%INPUT_NAME%.mpg.properties”
)

Start by printing the variables being passed to your custom command. The variables come from your metadata. Looks at your logs to see what metadata is being passed to MCEBuddy and you’ll have your answer why there’s an illegal character in your path somewhere.

How do I view the variables being passed by MCE in .7 or .8? Older versions would log the output from MCE on a debug log, but it doesn’t appear that is the case anymore. The only thing I can find is the actual variable names used logged.

I’ve confirmed the MCEBPostProcess.bat and the TVTransfer.bat are working when manually constructing CMD session using the file name produced by MCE.

Just modify your batch file to print the input variables and enclose them in quotes so you can see any white spaces or write them to a text file.

It doesn’t appear anything is being passed.

The text file is empty (I’m writing out the variables to a text file), but If I run the .bat file manually using:

“e:\videocaptures\cleaned files\mcebpostprocess.bat” “E:\VideoCaptures\Cleaned Files\Cops Dirty Laundry s30 e07 07-29-2017.ts” E:\VideoCaptures\Cops-S30E07-DirtyLaundry-62792569-0.ts “E:\VideoCaptures\Cleaned Files” 1080 .ts 2.500.852 07 28 2017 05

I get this:

BatFileName “E:\VideoCaptures\Cleaned Files\TVTransfer.bat”
VideoOutPut “Cops Dirty Laundry s30 e07 07-29-2017”
VideoInPut “Cops-S30E07-DirtyLaundry-62792569-0”
FolderOutPut “E:\VideoCaptures\Cleaned Files”
VideoWidth “1080”
OutputExt “.ts”
FileSize “2.500.852”
Month “07”
Year “2017”
Season 05

Here is the modified mcebpostprocess.bat

ECHO ON

setlocal EnableDelayedExpansion

SET BatFile=“E:\VideoCaptures\Cleaned Files\TVTransfer.bat”
SET OutputFileName=“%~n1”
SET InputFileName=“%~n2”
SET FolderOutput=“%~3”
SET WideoWidth=“%~4”
SET OutputExtension=“%~5”
SET OutputFileSize=“%~6”
SET OADMonth=“%~7”
SET OADDay=“%~8”
SET OADYear=“%~9”
SHIFT /4
SET SEASON=%~9

echo BatFileName %BatFile% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo VideoOutPut %OutputFileName% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo VideoInPut %InputFileName% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo FolderOutPut %FolderOutput% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo VideoWidth %WideoWidth% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo OutputExt %OutputExtension% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo FileSize %OutputFileSize% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo Month %OADMonth% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo Year %OADYear% >> C:\Users\Wolverine\Desktop\MCEVARS.txt
echo Season %SEASON% >> C:\Users\Wolverine\Desktop\MCEVARS.txt

Call %BatFile% %OutputFileName% %InputFileName% %FolderOutput% %WideoWidth% %OutputExtension% %OutputFileSize% %OADMonth% %OADDay% %OADYear% %SEASON%

Then your file has no metadata. Go through your conversion log to see what metadata Is being extracted from your file or attach your conversion log

I don’t know what to look for so I’ve attached it.

Cops-S30E07-DirtyLaundry-62792569-0.ts-TS-2017-08-02T16-01-23.2099867-04-00.zip (36.3 KB)

I don’t understand how MCE can rename the file with most of the same information that is being requested in the variables and still fail. I will assume the information is derived from 2 different places?

I don’t know, but this has my head spinning.

1 Like

I assume the the bat file really is set to SET sPAT="\\SERVER\Recorded TV\Other Shows" for the server and the forum software made it SET sPAT="\SERVER\Recorded TV\Other Shows" in the above comment.

Yes, that is correct.

I missed this completely, this is your issue. You’ve encapsulated your executable in quotes, when passed to Windows it throws an illegal path error because the path/filenames should not contain a " character. Remove that it should work fine, it should look like:

PostCustomCommandPath=E:\VideoCaptures\Cleaned Files\MCEBPostProcess.bat

Side note, you way want to update to today’s 2.4.8 BETA build, I noticed an issue with your IMDB metadata matching which we’ve patched up and that should give you your missing parental rating also.

EDIT: In today’s build we’ve also put a check for this invalid " character and MCEBuddy will remove it from the CustomCommandPath if encountered to avoid this failure.

That was it, removed the quotes and presto worked like a charm!

Thanks for correcting the parental rating issue so fast!

1 Like