Closed gitttt54 closed 2 years ago
Super clear. Basically: "if ABC is in the filename, add XYZ to the plex title". Then also give options for handling stuff like locked state. Maybe use a dictionary inside the file to define the "links"? Like this:
links = {
'(OmU)': '(OmU)',
'(English.Subbed)': '(English Only)',
'ABC': 'XYZ'
}
Because this way you can define multiple "links"/"connections" at the same time and this way rename all your titles at the same time instead of having to run the script again and again for every "link". And even have the script add multiple strings to the title if there are multiple different matches in the filename. Image this usecase:
links = {
'(en)': 'English',
'(nl)': 'Dutch',
'(it)': 'Italian'
}
Imagine a massive dict like this with every language and that way you can just add the language found in the filename to the title in plex. Way easier than running the script like 250+ times for every language.
This is actually really easy haha. You got it \:)
Exactly the way I wanted it to be!
Just for clarification,
if I have a Movie named Fresh Movie
in Plex with Filename Fresh.Movie.(1999).(OmU).(Remastered).xvid.mkv
and define, say,
links = {
'(OmU)': '(OmU)',
'(Remastered)': '(Remastered)'
}
The resulting Movie Title would be Fresh Movie (OmU) (Remastered)
with only one go of the script?
If yes, that really would be great! Thank you!
P.S.
Maybe its nice to have an option to ignore the case in the search string?
Just an idea, because I now saw some Filenames with (omu)
or (remastered)
and not only (OmU)
or (Remastered)
.
But this could be solved also with renaming the files from the command line or any renamer program too.
If yes, that really would be great! Thank you!
Yes
And about the case insensitivity: I'll just add an option to make the triggers (the keys in the dict) case insensitive.
Request completed. You can find it here: https://github.com/Casvt/Plex-scripts/blob/main/changing_settings/filename_to_title.py. Enjoy!
Hello,
Dunno.
Short: Rename (or add a suffix) the movie title in Plex when the filename of that movie has a user-definable string in it.
Long:
We have movies in foreign language only, say, japanese movies with japanese audio, and only german or english or russian subtitles to understand the movie. Plex Users often only see the Movie title and think "Hey, that is a great movie I always wanted to watch", but then are disappointed, because the movie does not contain audio in their native language, but only subtitles. This is the reason, why I'd like to have a script which automaticly "tells" the plex user: "Hey, this is a movie in a foreign language, and you have to watch it with subtitles only". This "telling" is done by changing the movie title accordingly ;-D
Here is a Text which explains it a little bit more: Here’s our regular listing of films being shown in English and other original foreign languages (with labels such as OmU, OF and OV) at Leipzig cinemas for this movie week. We are now running the list each Tuesday. Although not dubbed, the movies often come with German subtitles, so you can still access the movie if you don’t know the original language but know some German.
The MKV files have set the language correctly to, say, japanese language, so Plex users can see what spoken language the movie is before starting it, and can select their preferred subtitle (if not hardcoded).
Unfortunately, the movietitles do not show, that this movie is a foreign movie with only subtitles on the viewers language, and therefore, I need to rename all the movies from, say
Japanese Movie
toJapanese Movie (OmU)
, when the Filename contains a string(OmU)
. So, if the filename isJapanese.Movie.1999.(OmU).mp3.xvid.mkv
, the Script should rename the movietitle fromJapanese Movie
toJapanese Movie (OmU)
(or add a suffix(OmU)
, if this will be easier....).Important: it must be checked, if the movietitle already has an
(OmU)
, because we don't want titles likeJapanese Movie (OmU) (OmU) (OmU)
Here is a list with movies for more examples:
In the script I'd like to define 2 main options:
the first string which the script is looking for in the filename and a second string which is used to rename or to put a suffix on the filename.
So I could call the script like:
superscript.py --StringToLookFor "(OmU)" --StringToAppendToMovieTitle "(OmU)"
orsuperscript.py --StringToLookFor "(English.Subbed)" --StringToAppendToMovieTitle "(English Only)"
I dont' know, if it is a good idea to lock the movie title field after renaming, but it could be optional in the script by an additional option like
--LockAfterRenaming
.Also, with this, I don't know, if the script should or should not rename locked titles fields, but I guess, a "force rename locked title field" option would then also be an option to think about.
I personally lock all the fields, I have manually changed, to have Plex not change them again, but with this Script, I really would like to change those title fields, regardless of its locked state. So I don't know, what is the best practice here.
Ok, I hope, you have no trouble understand why I'd like to have this script and how it should work.
I will be glad to answer questions, if there are any.
Thank you!