Skip to content

Get a PlexObject by rating_key #299

@kafkaguru

Description

@kafkaguru

I've read the docs and looked at the source code and, please correct me if I am wrong and point me in the right direction, but I did not see a way to get a PlexObject by it's rating key.
I've been using a script to add a label to all recently added items and this works:

headers = {"X-Plex-Token": PLEX_TOKEN}
    params = {"type": 1,
              "id": rating_key,
              "label.locked": 1,
              "label[0].tag.tag": LABEL
              }

    url = "{base_url}/library/sections/{section_id}/all".format(base_url=PLEX_URL, section_id=section_id)
    r = requests.put(url, headers=headers, params=params)

I really like this plex api and I would like to be able to get a PlexObject via its rating_key like so:

plex = PlexServer(baseurl, token)
item = plex.library.sectionByID(section_id).get(rating_key)

or

plex = PlexServer(baseurl, token)
item = plex.library.sectionByID(section_id).getByRatingKey(rating_key)

or some way that is in line with your standards.

Please let me know your thoughts. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions