自定义命令失败

我不確定是什麼觸發了這個問題,是 OS 更新還是 MCEB 更新,但在 build .7 和 .8 中,轉換後的檔案不再被移動到我的網路磁碟。

這已經正常運作多年,所以我不確定我做了什麼導致問題。

照例,我已經用管理員帳號的使用者更新了服務。我也嘗試在 UI 的設定下將同一使用者加入網路驗證設定。

我在轉換記錄中注意到這個,但我不明白為什麼,因為路徑中並沒有非法字元。

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

我把兩份記錄檔都上傳到 FTP 伺服器了。

这是因为您的自定义命令生成了无效命令:

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: 路径中存在非法字符。
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()

您的自定义命令为其批处理文件生成了无效的路径字符。

嗯,是不是在 build .7(.8)裡有什麼變動,還是我自己搞砸了?(我並沒有刻意做任何更動)我已經翻遍系統備份,回到 30 天前,下面這些檔案都沒看到任何變化。

這是 profile 裡顯示的指令字串:

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

這是被呼叫的 .bat 檔:

@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%

這才是真正幹活的 .bat 檔:

@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”
)

首先打印传递给自定义命令的变量。这些变量来自你的元数据。查看日志,了解哪些元数据被传递给 MCEBuddy,你就能明白为什么路径中会出现非法字符。

我要如何查看 MCE 在 .7 或 .8 版本中傳遞的變數?舊版會把 MCE 的輸出寫進除錯紀錄,但現在似乎不再這麼做,我只能找到被記錄下來的實際變數名稱。

我已確認手動用 MCE 產生的檔名建立 CMD 工作階段時,MCEBPostProcess.bat 與 TVTransfer.bat 都能正常運作。

只需修改你的批处理文件,打印输入变量并用引号括起来,这样你就能看到任何空白字符,或者将它们写入文本文件。

看起來沒有任何參數被傳入。

文字檔是空的(我正在把變數寫入文字檔),但如果我手動執行 .bat 檔案:

“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

我會得到:

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

以下是修改後的 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%

那么你的文件没有元数据。请查看你的转换日志,看看从文件中提取了什么元数据,或者附上你的转换日志。

我不知道该找什么,所以我已经附上了。

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

我不明白 MCE 為什麼能在變數中取得大部分相同的資訊來重新命名檔案,卻仍然失敗。我假設這些資訊是來自兩個不同的地方?

我不知道,但這讓我頭昏腦脹。

我假设这个批处理文件确实设置为 SET sPAT=\"\\\\SERVER\\Recorded TV\\Other Shows\" 用于服务器,而论坛软件在上面的评论中将其显示为 SET sPAT="\SERVER\Recorded TV\Other Shows"

是的,這是正確的。

我完全漏掉了这一点,这就是你的问题所在。你把可执行文件用引号包裹了,当传递给 Windows 时会抛出非法路径错误,因为路径/文件名不应包含 \" 字符。去掉它就能正常工作,应该写成:

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

顺便提一句,你可能想更新到今天的 2.4.8 BETA 版本,我们注意到你的 IMDB 元数据匹配有问题,已经修复,这样也能恢复缺失的家长分级。

编辑:在今天的版本中,我们还添加了对这个非法 \" 字符的检查,如果遇到,MCEBuddy 会自动从 CustomCommandPath 中移除,以避免此类失败。

就是这样,去掉引号后,presto 立刻就正常工作了!

感谢你这么快就修复了家长评级的问题!