我看過有關前處理與後處理指令稿的參考與提及,但找不到明確的說明文件。任何協助都感激不盡,先謝了。
以下是关于自定义命令的权威来源
据我了解,你可以调用多种东西,比如一个 Windows 批处理文件。我个人会调用 PowerShell 脚本进行后期处理,包括一些自定义重命名,这是 MCEBuddy 无法实现的;它还会把转换后的文件移动到我想要的目录结构,并在文件已存在时处理覆盖/删除。
基本做法是在 profiles.conf 里为特定配置文件定义要调用的脚本。
例如,我的其中一个配置如下:
[MP4 Unprocessed]
Description=Very fast but limited functionality. Use this profile if the original video has H.264/MPEG video and you want to remove the commercials and convert the file format to MP4 (e.g. WTV to MP4) without any additional processing (deinterlace, resizing, volume, cropping etc). It will copy the original video and audio and put it into a MP4 format unaltered in quality.
order=ffmpeg
ffmpeg-general=-threads 0
ffmpeg-video=-ss 0 -vcodec copy -sn
ffmpeg-audio=-acodec copy
ffmpeg-audioac3=-acodec copy
ffmpeg-ext=.mp4
ffmpeg-audiodelay=skip
PreConversionCommercialRemover=true
FixedResolution=true
SkipCropping=true
AutoDeinterlace=false
PostCustomCommandPath = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
PostCustomCommandParameters = -windowstyle hidden -file “f:\transfer\mcebuddy_postprocess.ps1” -newname “"%convertedfile%"” -destpath “"%destinationpath%"” -series “"%seriesid%"” -imdb “"%imdbmovieid%"” -ismovie “"%ismovie%"” -taskname “"%taskname%"” -season “"%season%##"” -origName “"%originalfilename%"”
PostCustomCommandHangPeriod = 0
PostCustomCommandCritical = False
PostCustomCommandUISession = False
PostCustomCommandShowWindow = True
PostCustomCommandExitCodeCheck = False
PostCustomCommandPath 指定调用 PowerShell,PostCustomCommandParameters 告诉它要运行的 PowerShell 脚本,并传入 MCEBuddy 暴露的大量值,例如文件名。
我的实际 PowerShell 脚本很长,其中一项功能是读取这些传入值,并根据是电影还是电视剧,在文件夹名称里加入 IMDb ID 或 TVDb ID。MCEBuddy 内置的重命名似乎无法使用这些值作为参数。
FYI - 公开的 IMDB API 已经失效。亚马逊收购后,将其 API 设为付费墙。
我认为 MCEBuddy 已改用 https://www.themoviedb.org/ (TMDB) 作为替代。你可以考虑将你的 PowerShell 脚本也做相应调整。
我得先確認 Plex 在做什麼,但我之前是按照一些文件的建議來命名,好讓它能辨識內容
電視劇-上層資料夾:
例如 CSI Vegas (2021) {tvdb-400248}
電影-上層資料夾:
The Mortal Storm (1940) {imdb-tt0032811}
問題是,在重新命名時我找不到 tvdb 的劇集 ID 佔位符,但在後製處理裡確實有這個佔位符,所以我只是從 mcebuddy 把參數傳給 powershell,讓它把原始資料夾從
CSI Vegas (2021)
改成
CSI Vegas (2021) {tvdb-400248}
不過最近偶爾會抓不到劇集 ID,我還不確定原因。
總之,我的 powershell 腳本會負責重新命名上層資料夾,然後把檔案搬到我的 plex 伺服器,並判斷是要複製到現有資料夾(例如電視劇)還是直接覆蓋(電影的情況)。