I’m writing my first metadata agent. It’s a conversion from a javascript code I have that writes an xml file.
So I have the code in python to collect information from a url such as:
- Title
- Description/Summary
- Rating (MPAA)
- Rating (Critic)
- Poster url
- Fanart url
- Duration
- Director
- Studio
- Collection
Arrays:
- Genre
- Actor name
- Actor image url
- Actor role
So here are my initial questions.
- What information is passed to the python script from Plex when refreshing metadata? I’m hoping the path of the video file as I would like to parse the path for some info. I need the FolderName and VideoKey to build the url to scrape from.
L:\Movies\FolderName\My Video (VideoKey) - Resolution.ext
-
Do I need my own scanner agent or can I use a built in one, assuming I name the files like above?
-
Once I have the data; how do I pass it back to Plex? Do I have to write the xml myself or just set a variable that Plex with intercept automatically?
Something like this is what I imagine, but not sure.
plex_title = scraped_title
- Is there any documentation on developing metadata agents?
Got most of this figured out. Some new questions though.
Is it possible to use custom images for these? I’m able to populate them with a URL; however it doesn’t change what is displayed. Only the default star is shown (at least on Android clients).
metadata.reviews.image
metadata.audience_rating_image
metadata.rating_image
Also if I have the url of a video to use as a trailer, how would I add that?
1 Like
Did you get any information in regards to these rating images?
Kind Regards
No, that was the one thing I couldn’t figure out.
Currently, I am trying to figure how to put custom pictures in collections… as collections show up as a mashup of film posters… Any idea???
As far as I know you can’t update collection posters with a metadata agent. I think you can use python-plexapi though.
It’s not super easy to integrate python-plexapi into a metadata agent, due to Plex still being on Python 2.7. Even though the differences are minimal to have it work in 2.7, the maintainers are not interested in keeping compatibility. I have a python 2.7 version, here, but I don’t know how long I plan on maintaining it.
Many thanks for helping out. I really appreciate it.
Do you have any idea, where the information for collections is stored.
I can see that one can vie the XML files for a film.
Is this info stored on disk?
The entire database is stored in the sql database file.
I looked through the sql file andcould see no traces of the collections…
So, this was my final attempt at having custom rating images.
if metadata.audience_rating >= 5.0:
rating_image = 'rating_up.png'
else:
rating_image = 'rating_down.png'
metadata.audience_rating_image = Resource.ExternalPath(rating_image) # can also use `R` instead of `Resource.ExternalPath`
The image is exposed at: https://<plex_server>:32400/:/plugins/<plugin_identifier>/resources/rating_up.png?t=<timestamp>&X-Plex-Token=<plex_token>
or shorter version without timestamp: https://<plex_server>:32400/:/plugins/<plugin_identifier>/resources/rating_up.png?X-Plex-Token=<plex_token>
It still doesn’t show in the clients. I’m guessing the rating images are hard coded into the clients instead of them downloading them from the server. The web client has SVG images here and doesn’t appear to load these resources from the web server at all.
Since Plex simply doesn’t care about plugins or third party development anymore, this is unlikely to ever get fixed up.
I also now have a working YouTube URL service. I will publish the code soon so other plugins can utilize it.
metadata.reviews.image can only accept 2 enum string: ‘fresh’, ‘rotten’.
I just test on my server with the value ‘fresh’, and the tomato logo just apear.
As for documentation, there is only a outdated one released in 2011.
Yeah, 11 years ago.