mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-22 20:43:07 +00:00
[13] #831 cache fetched items
This commit is contained in:
parent
e887bcbffb
commit
182f977a91
3 changed files with 7 additions and 2 deletions
2
VERSION
2
VERSION
|
@ -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…
Reference in a new issue