anthonws 42 Posted December 11, 2019 Posted December 11, 2019 Anyone knows how I can achieve something similar to what I have with Plex? from plexapi.server import PlexServer from collections import defaultdict baseurl = 'my' token = 'my' plex = PlexServer(baseurl, token) def to_tags(labels): return [l.tag for l in labels] movies_section = plex.library.section('Movies') movies = defaultdict(list) added = movies_section.search(sort='addedAt:desc') for movie in added: movies[movie.title].append(movie) for title, entries in movies.items(): for entry in entries: if 'Transcodable' not in to_tags(entry.labels) and entry.media[0].videoResolution != '4k': entry.addLabel('Transcodable') if 'Transcodable' in to_tags(entry.labels) and entry.media[0].videoResolution == '4k': entry.removeLabel('Transcodable') if 'Transcodable' not in to_tags(entry.labels) and entry.media[0].videoCodec == 'h264': entry.addLabel('Transcodable') if 'Transcodable' in to_tags(entry.labels) and entry.media[0].videoCodec == 'hevc': entry.removeLabel('Transcodable')
mastrmind11 722 Posted December 11, 2019 Posted December 11, 2019 Without more code showing it's not easy to determine what you're actually doing. Is this just renaming files based on some criteria, or are you actually changing state within plex? anyway, take a look at the emby api docs. 1
anthonws 42 Posted December 11, 2019 Author Posted December 11, 2019 Without more code showing it's not easy to determine what you're actually doing. Is this just renaming files based on some criteria, or are you actually changing state within plex? anyway, take a look at the emby api docs. That is the whole script I'm basically just tagging media based on their codec/resolution, so that I can determine which users can or cannot see H.265 or 4K resolution media (for example). I went through the API, but it doesn't seem to be that simple, of getting an automated job to run such a thing. But I'm might be wrong. If anyone already did something like this, please share Cheers, anthonws.
Luke 42085 Posted December 12, 2019 Posted December 12, 2019 you'd have to use the same api that the metadata editor uses to retrieve an item, update tags and then save it back.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now