Examples of Renaming

This is more of a suggestion than a question. But I will take whatever I can get.

I just added a new mini pc to my network just for the purpose of running Plex and MCEBuddy. Along with this, I upgraded MCEBuddy from 2.5 that I’ve used successfully for quite awhile and now have 2.64 installed.

Things were working fine in 2.5 but am now having issues with MCEBuddy adding the recording date to the end of the Movie name and Plex doesn’t like that. I would prefer just the movie name and possibly the year it first came out saved into a folder with the movie name.

Bad: The Bourne Ultimatum - 2024-11-23 2211.mp4
Good: The Bourne Ultimatum - 2007.mp4

I have Plex recording movies in DVR Recordings and shows in DVR TV Recordings on the mini PC. MCEBuddy watches these 2 folders. Once MCEBuddy is done, my final destination is to TV or movie folders on my NAS drive

So I’ve searched MCEBuddy for an example I can use but confusing the hell out of me.

Suggestion: It sure would be great for someone to create a list of descriptions and examples for renaming on a page so users like myself could simply copy & paste them in. The list could include movies & TV shows combined as well as separating them out to a simplified version like I am looking for.

oops, I meant to put the year in parenthesis
The Bourne Ultimatum (2007).mp4

I use plex and this is how I have my single task handle both movies and tv shows.

\%ismovie%<Movies\%showname%%ifairdate%< (%airyear%),>\%showname%,TV\showname%%ifpremieredate%< (%premiereyear%),>\Season %ifseason%<%season%##,00>\%showname% - S%ifseason%<%season%##,00>E%episode%## - %episodename%>

Let’s break it down:
%ismovie%<> This is a logic true/false check. If it’s a movie the first segment up to the comma is used if false use the 2nd segment. I have some nesting of these type of check within all of this as well.
So, if it’s a movie the path is going to be Movies\ then the show name and if there is an airdate include (air date) in the folder name otherwise don’t add anything to folder name. Then the name of the show/movie.
End Result: \Movie\The Bourne Ultimatum (2007)\The Bourne Ultimatum.mp4

If it’s not a movie then it’s going to be placed in TV folder. Then a folder for the name and if there is a premieredate put that in (). A sub folder for the Season is created and if there is a season it will put leading zero season number and if there is not season it will do 00. So, it would look like Season 01 if there is a season and if there isn’t it would be Season 00. Then the file is named Show name - S then the same season number logic as folder name, E episode number - episode name.
End Results: \TV\Breaking Bad (2008)\Season 01\Breaking Bad - S01E01 - Pilot.mp4

I don’t put the year in the filename and instead in the folder name the file(s) sit under. Plex is able to use this to match without issue. But it could be matching due to metadata as well.

But for a basic include the year for a movie you can use
%showname% (%airdate%)

2 Likes

Great Information! I think I’m actually beginning to understand.

I changed the destination of the completed movie to the main Plex folder on my NAS since your code should recognize it as a movie and place it automatically in the Movies folder.

I copied and pasted what you had and ran a test on “2 Guns”.

I think we are missing some backslashes since the 2 Guns didn’t make it to the Movies folder and got saved in the main Plex folder with no “2 Guns” folder as you can see in the pic below.

I’m not sure how the backslash works with the %, so I was hoping you could look at it and help me with the issue.

Thanks so much,
Tim

You are correct, it looks like the forum post stripped out the backslashes. Try this:
\%ismovie%<Movies\%showname%%ifairdate%< (%airyear%),>\%showname%,TV\showname%%ifpremieredate%< (%premiereyear%),>\Season %ifseason%<%season%##,00>\%showname% - S%ifseason%<%season%##,00>E%episode%## - %episodename%>

Also, @Goose fixed my original reply so the slashes show. Thanks Goose.

I just converted a movie and it worked GREAT! Thanks so much. I love how you use the same script for both shows and movies.
Right now, my movies & shows are separated into 2 tasks because I am physically saving my Plex TV shows on a different computer running a 2nd version of Plex server due to storage space issues. I plugged in your entire script into my movie conversion task but am thinking of using only the single task as you are doing. To this purpose, do you know if there’s a way to add an IP address or server name in this script for the TV Shows location?

There isn’t a way to change the root destination within the rename string. So, you’d still need two tasks in your case. But you could use the same rename string. Unless you can map the location on one server to the other.

Thanks so picking this issue up and running with me. I’ll use your idea and look at solving it with mapping.
Do you know of a link where the available commands are located for MCEBuddy? I’ve done some programming in a past life and just curious to learn more in MCEBuddy.

Here is the section on file renaming.
MCEBuddy - Advanced Settings, Commands and Tweaking - Getting Started, Guides and FAQs / Guides and Solutions - MCEBuddy
This is part of the profile.

I just thought of a way a couple of ways you might be able to have a single task.

1 - Use PostCustomCommand. (Probably a little more complicated than option 2nd option)
You could write a script that could use parameters to move the file to the other location if it belongs there.
Here are the variables that are available.
MCEBuddy - Advanced Settings, Commands and Tweaking - Getting Started, Guides and FAQs / Guides and Solutions - MCEBuddy

For example, you could have a postcustomcommand script named something like moveTVShows.ps1. It could have a parameter that would be like isMovie (isTVShow isn’t a variable) and pass the %ismovie% and if it’s false you know to process if not. That would be first logic check in script. The rest would be using a combination of %destinationpath% and %convertedfilename% to determine what to move and what to potentially create at destination.

Example profile addition using PowerShell Core:

PostCustomCommandPath="C:\Program Files\PowerShell\7\pwsh.exe"
PostCustomCommandParameters="path to ps1 script file" -isMovie %ismovie% -DestinationPath "%destinationpath%" -DestinationFileBaseName "%convertedfilename%"
PostCustomCommandHangPeriod=0
PostCustomCommandCritical=false
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false

2 - Have a scheduled task that moves files from the TV location on your movie server to the TV location on your TV server. Something simple using robocopy should work. Below example probably needs tweaks, been awhile since I’ve used robocopy.

robocopy.exe "\\MovieServer\Plex\TV" "\\TVServer\Plex\TV" /S /MOV /V /NP