I am currently looking for a way to automatically populate Plex playlists based on certain criteria when adding movies to a library or update their metadata.
I am working on a metadata scraper to add info on movie Awards and Nominations to movies.
I am matching IMDB IDs of movies against large tables to find out if a movie received a certain award. Since there is no data fiels for that in Plex movie objects, I let the user decide whether to use reviews or collection to mark that movie.
BUT, I would love to offer the user a third choice: to automatically add playlists for prize categories and to automatically add movies to these playlists?
Is there a way for a customized python metadata agent to access playlist info?
… to add playlists?
… to add a movie to a certain playlist?
I did not see anything like that yet, so I doubt it. But maybe some expert like @PlexMovieFan or anybody else may know the answer?
Please help if you can… I will do the python part of it then
If you can attach a “collection” tag to an item with your script, you could use the Custom Filter and create a smart playlist.
(there is also a ‘Label’ filter now, but this is only available to the server admin)
Thank you @OttoKerner.
This is indeed a solution I had already thought of.
But as creating “collection” tags with my scraper unfortunately removes the collection tags from TMDB (I am not aware if this is due to poor programming skills on my side or by design / same with reviews… adding reviews is not showing any other reviews), I would love to keep both solutions independent from each other.
After adding a second collection to one of ym videos, I found this in my server log PUT /library/sections/24/all?type=1&id=981937&includeExternalMedia=1&collection%5B0%5D.tag.tag=Jethro%20Tull&collection%5B1%5D.tag.tag=testcollection section is the library ID id is the ratingKey from the Plex XML info
The two collections are named “Jethro Tull” and “testcollection” in this case.
This should enable you to build your own http PUT query with curl or similar.
You might have to read existing collections first and include them into the query. Otherwise you might overwrite existing collection info on the item.
In my example even though I only added one new collection to the video, the API query contained both the existing and the new collection name.