So here’s the result of my tinkering with genres a bit. It doesn’t get the genres from an online source, rather it looks at what the Freebase agent already pulled down, and tries to match those to proper broad genres (so “Screwball Comedy” just becomes “Comedy”).
It’s not perfect-- it bases its classifications on a substring search, so if a movie had a genre of “War Between the Sexes” on Freebase, it would classify it as a “War” film. But using this along with Rotten Tomatoes ought to get even a large movie collection down to the point where any bad genres can be weeded out manually.
Just double-click to install, Follow the instructions in this support document and then place it above Freebase Plex Movie in the Metadata Agent Settings.
Download link to the the bundle: /uploads/default/original/3X/5/5/55480ce792cb6c2f6693dc3b2d0460ac84f590ec.zip (use this one instead of the old “.plexapp” file that is attached to this post)
Updated/edited by sander1 on 25 Feb 2018.
Great idea - thanks. Could this also be used to translate the genres to german?
So let’s say we have 20 “main genres”. Some of them are added manually and some are scanned by moviepilot, freebase and others. Would it translate all the genres?
I could give you a list of translated genres if you are interested.
It could very easily be altered to translate the Freebase genres to German (or any other language, for that matter), but it will only change the ones that came from Freebase.
Do this:
Right-click on the bundle, and select show package contents. Go into Contents/Code/ and open the file init.py in a text editor.
The first part looks like this:
GENRE_DICT = { 'Action/Adventure' : ['action','adventure'],<br />
'Animation' : ['animation','cartoon','anime','animated'],<br />
'Comedy' : ['comedy'], <br />
"Children's" : ['children',"kids","kid's","children's"],<br />
'Crime' : ['crime','criminal'],<br />
'Documentary' : ['documentary'], <br />
'Drama' : ['drama'],<br />
'Erotic' : ['erotic'], <br />
'Family' : ['family'], <br />
'Film Noir' : ['noir'],<br />
'Historical' : ['epic','historical','history'], <br />
'Holiday' : ["holiday", "christmas"],<br />
'Horror' : ['horror'], <br />
'Musical' : ['musical'], <br />
'Mystery' : ['mystery'], <br />
'Romance' : ['romance','romantic'], <br />
'Science Fiction/Fantasy' : ['science fiction','fantasy','sci fi','sci-fi'], <br />
'Suspense' : ['suspense'], <br />
'Thriller' : ['thriller'], <br />
'War' : ['war'], <br />
'Western' : ['western'] }
Translate the name on the left. The list on the right is the strings that it looks for in the data that got pulled down from Freebase. You can save your changes with a regular text editor, refresh your movies, and your changes should be reflected immediately. (You don't need to restart PMS or anything.)
Thanks.
Right now I am updating the files to work in German. I will post it as soon as it is final.
According to themoviedb.org and other pages you are missing some main genres. Please reply if you think there should be more or less.
**Missing Main Genres (suggestion)
**
[list]
[]Eastern
[]Martial Arts
[]Disaster
[]Biography
[]Short Film
[]Sport
[]Animals
[]Fan Film
[]Indie
[]Music
Road Movie
[/list]
Btw.: I suggest to use action and adventure separately. Not every action movie is an adventure movie. But I guess you made it so because you can’t split action/adventure. Or is it possible to translate “action/adventure)” and add both genres separately?
People are free to alter the agent however they like. You can separate action and adventure, or add in any genres you feel are missing. (Just stick to the pattern of the other lines, if you add anything in.) I started this based on a discussion where someone said having much more than ten genres was not useful for them, so I erred on the side of paring down into broad genres.
I’m not going to be making updates to this (I don’t even use it), but I’m happy to help debug modifications if anyone needs it.
Thank you for this. I’m making progress. I have just experienced these issues:
If the movie contains a ß it doesn’t work.
On many (all?) movies it changes some genres although they are in the list.
I use the moviepilot agent which loads the genres from themoviedb.org. Could this be the issue and how can I fix it?
http://forums.plexapp.com/index.php/topic/18854-moviepilot/
I would be interested in using this but would want to know what the consensus is from everyone on how many/which genres to use. Those you have currently look great to me but I could see how adding those dawiinci mentioned would be useful too.
Hi Raindancing, once again good work!
I’ll give it a spin and dive into the genre rewrite details this weekend. Still have to decide what I want to use as my set of standard genres to work with. Either go for the IMDB classifications or for the Rotten Tomatoes genres.
Just a FYI: The Moviepilot agent does not handle genres **at all**.
Thanks. I "meant" it like this. ;) In that case the genres come from themoviedb.org or basically any other source and not necessarily from freebase itself.
I fixed it by changing the code to ['com.plexapp.agents. themoviedb']. I guess it loads the genres from there and translates it. ['com.plexapp.agents. imdb'] loads the genres from freebase.
The movies with ß in the title are working too - maybe because of using themoviedb.org.
Interesting.
Is the problem that if the *title* of the movie contains the ß it doesn't work? I don't see how that should be-- it doesn't even look at the title.
And we'll take Sander's word for it that Moviepilot doesn't handle genres. :) That means your genres are being supplied by themoviedb agent if that website has them, and Freebase if not. This agent will only look at the ones that Freebase returns. I can walk you through getting it to translate the others as well, but let's first make sure that it is working the way it's intended to.
What I suggest is that, for the purposes of testing, you make a new section, and move three or four movies into it. (I tend to make mine on the network share that actually has my movies on it, so I can just move stuff freely in and out of the test section.)
For your test section, enable only Freebase and TidyGenres in the agent settings. Let's try to get to the bottom of that wacky ß issue. Put a movie with a ß in it into your test section, update the section and post the log, which you'll find at ~/Library/Logs/PMS Plugin Logs/com.plexapp.agents.tidygenres.log (you'll have to zip it up to post it).
Glad to hear you got it working while I was spending too long typing that last post.
Thanks for your explanation - made it a lot clearer.
So for those movies that aren't at TMDB it falls back to freebase. Because of this I have to add translations for this too. I think with these two I can cover most of the movies. How can I add a second source?
When I finish the plugin I want to make it public. Can I just change any code from "Tidy" to "German" or do I have to make a .plexapp? (however that works) I tried to change the name and any code but the plugin disappeared. I don't want to make the users confused by having a plugin that is named the same as yours.
If you’re using this primarily for the purposes of translation (or even if that’s not your primary purpose, who knows), you may want to lump genres in from both Freebase and TheMovieDB. This version of the update function should do that.
def update(self, metadata, media, lang):<br />
freebase_metadata = metadata.contribution('com.plexapp.agents.imdb')<br />
themoviedb_metadata = metadata.contribution('com.plexapp.agents.themoviedb')<br />
freebase_genres = freebase_metadata.genres<br />
themoviedb_genres = themoviedb_metadata.genres<br />
clean_genres = []<br />
old_genres = []<br />
for fb_genre in freebase_genres:<br />
old_genres.append(fb_genre)<br />
for tmdb_genre in themoviedb_genres:<br />
old_genres.append(tmdb_genre)<br />
<br />
for bad_genre in old_genres:<br />
for genre in GENRE_DICT.keys():<br />
for equiv_genre in GENRE_DICT[genre]:<br />
if bad_genre.lower().find(equiv_genre) != -1:<br />
clean_genres.append(genre)<br />
clean_genres = set(clean_genres)<br />
metadata.genres.clear()<br />
for blip in clean_genres:<br />
metadata.genres.add(blip)
(Warning: I haven't tested it, but it should work, barring typos)
Similarly, you could add any other agent that returns genres.
We must have been psychically linked. See above. :)
Change Tidy to German in the code and also in the Info.plist file. (And also change the name of the actual bundle.)
There's a little app pinned to the top of the plugin developers forum that makes the plexapp installer. It's not necessary (you can just tell people to put the bundle in ~/L/AS/PMS/Plugins/) but it makes it easier for people.
I tried your additional code and replaced the update function only. But it doesn’t work for the freebase movies. I disabled TMDB and the genres are freebase-like but not translated. The movies recognized by TMDB are translated fine.
However I will try to find out what’s going on. Sometimes it works, sometimes not.
I will edit or reply as soon as I have more accurate information.
Post the log, and I’ll try to help debug.
It's funny but unlike earlier times all data is collected from moviepilot and TMDB. So I couldn't even test if freebase works. However it's probably not even needed.
Thank you very much Raindancing for your help with the code and the .plexapp.
Anyway you could post the .bundle file in a zip or tell me how to extract the .bundle from the .plexapp file? I’m trying to ssh the folder to my NAS folder structure. Thanks!
Here you go!