How to automatically add movies to playlists?

Dear all,

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 :wink:

If you can attach a “collection” tag to an item with your script, you could use the Custom Filter and create a smart playlist.
grafik
(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.

I really like the idea of creating labels for awards.
How do I do this?

metadata.tags.add(“Academy Awards”) or
metadata.tags = [ “Academy Awards” ]

do not thow an error, obviously, it does not create labels either.
What would be the way to access those labels which can be used to filter?

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.

Since I am working from within a metadata agent, using the local web server is prohibited by the python framework.

It checks for urls containing “:32400” and since my agent does not have “system” rights, it does not work.

Then I am unfortunately out of ideas.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.