How to write pre & post process scripts

I’ve seen references and mentions about pre & post processing scripts. But, am unable to find definitive documentation how to do so. any help is appreciated. tia

Here’s the authoritative source on custom commands

My understanding is there are multiple things you could call, e.g. a windows batch file. I personally call a PowerShell script for some post processing which includes some custom renaming that mcebuddy doesn’t allow me to do, and it also handles moving the converted files into the file structure I want and handles some overwriting/deleting if already existing.

Basically you call the script in the profiles.conf by defining the ones you want into the specific profile.
So for example in mine, one of my profiles is:

[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

The PostCustomCommandPath tells it I’m calling powershell, and the PostCustomCommandParameters tells it which powershell script to run, as well as passing in a bunch of values that are exposed by mcebuddy, for example the name.

My actual powershell is quite long, but one of the things it does is look at these passed in values, and adjusts the folder names to include either the imdb id or tvdb id depending if movie or tv show. The built in renaming in mcebuddy doesn’t appear to have arguments for these values.

FYI - The public IMDB API is dead. After Amazon bought them, they monetized it behind an API paywall.

I think MCEBuddy has switched over to using https://www.themoviedb.org/ (TMDB) as its replacement. You might consider adjusting your PowerShell script to do the same.

I’ll have to check what Plex is doing, but I was following some documents suggesting naming items like this to help it identify the items
TV Series - Parent Folder:
e.g. CSI Vegas (2021) {tvdb-400248}
and Movies - Parent Folder:
The Mortal Storm (1940) {imdb-tt0032811}

The things was in the renaming I couldn’t find a placeholder for the series id from tvdb, but there is a placeholder for it available in the post processing, so all I’m doing is passing the argument from mcebuddy to powershell to take the original folder and rename it from

CSI Vegas (2021)
to
CSI Vegas (2021) {tvdb-400248}

There has been the odd time lately though that the series id is not retrieved and I’m not sure why.

Anyway, so my powershell scripts handle renaming parent folders then moving the items over to my plex server and determining whether to copy into existing folder (for tv series for example) or overwrite (in the case of movies).