Skip to content

Looping through shows is slow? #1188

Description

@stevezau

Describe the Bug

Hi, I am looping through shows trying to get the paths.

plex_shows = [m for m in plex.library.section('TV Shows').all()]
plex_shows_by_path = {m.locations[0]: m for m in plex_shows}

It is extremely slow. It seems to be querying plex for each item in the location loop. Is there a faster way to do this? I would have thought the data would be pulled from the first line?

Code Snippets

No response

Expected Behavior

No response

Additional Context

No response

Operating System and Version

Linux

Plex Media Server Version

Latest

Python Version

3.11.2

PlexAPI Version

Latest

Activity

  1. JonnyWong16 commented on Jul 21, 2023

    @JonnyWong16
    Collaborator

    This is expected behaviour.

    The location attribute is not available when querying Plex's /all endpoint using all() and will only return partial objects (you can check with show.isPartialObject() or show.isFullObject()). Objects are automatically reloaded (see reload()) for you when you access a missing attribute which requires querying Plex for the metadata of the individual show.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions