[13] #831 cache fetched items

pull/858/head
meisnate12 3 years ago
parent e887bcbffb
commit 182f977a91

@ -1 +1 @@
1.16.5-develop12
1.16.5-develop13

@ -1955,9 +1955,13 @@ class CollectionBuilder:
def fetch_item(self, item):
try:
current = self.library.fetchItem(item.ratingKey if isinstance(item, (Movie, Show, Season, Episode, Artist, Album, Track)) else int(item))
key = item.ratingKey if isinstance(item, (Movie, Show, Season, Episode, Artist, Album, Track)) else int(item)
if key in self.library.cached_items:
return self.library.cached_items[key]
current = self.library.fetchItem(key)
if not isinstance(current, (Movie, Show, Season, Episode, Artist, Album, Track)):
raise NotFound
self.library.cached_items[key] = current
return current
except (BadRequest, NotFound):
raise Failed(f"Plex Error: Item {item} not found")

@ -357,6 +357,7 @@ class Plex(Library):
self._users = []
self._all_items = []
self.cached_items = {}
self.agent = self.Plex.agent
self.is_movie = self.type == "Movie"
self.is_show = self.type == "Show"

Loading…
Cancel
Save