From e3ffced21939a8b747d1f55c39e6db0c2d69f2c1 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 8 Mar 2021 10:25:35 -0500 Subject: [PATCH] added trakt list descriptions --- modules/builder.py | 7 +++++++ modules/trakttv.py | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index 5522ea1a..9ba332d9 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -313,6 +313,12 @@ class CollectionBuilder: self.methods.append((method_name, config.AniDB.validate_anidb_list(util.get_int_list(data[m], "AniDB ID"), self.library.Plex.language))) elif method_name == "trakt_list": self.methods.append((method_name, config.Trakt.validate_trakt_list(util.get_list(data[m])))) + elif method_name == "trakt_list_details": + valid_list = config.Trakt.validate_trakt_list(util.get_list(data[m])) + item = config.Trakt.standard_list(valid_list[0]) + if hasattr(item, "description") and item.description: + self.summaries[method_name] = item.description + self.methods.append((method_name[:-8], valid_list)) elif method_name == "trakt_watchlist": self.methods.append((method_name, config.Trakt.validate_trakt_watchlist(util.get_list(data[m]), self.library.is_movie))) elif method_name == "imdb_list": @@ -747,6 +753,7 @@ class CollectionBuilder: elif "tmdb_biography" in self.summaries: summary = get_summary("tmdb_biography", self.summaries) elif "tmdb_person" in self.summaries: summary = get_summary("tmdb_person", self.summaries) elif "tmdb_collection_details" in self.summaries: summary = get_summary("tmdb_collection_details", self.summaries) + elif "trakt_list_details" in self.summaries: summary = get_summary("trakt_list_details", self.summaries) elif "tmdb_list_details" in self.summaries: summary = get_summary("tmdb_list_details", self.summaries) elif "tmdb_actor_details" in self.summaries: summary = get_summary("tmdb_actor_details", self.summaries) elif "tmdb_crew_details" in self.summaries: summary = get_summary("tmdb_crew_details", self.summaries) diff --git a/modules/trakttv.py b/modules/trakttv.py index c82d235c..2ffcb9ca 100644 --- a/modules/trakttv.py +++ b/modules/trakttv.py @@ -105,10 +105,10 @@ class TraktAPI: @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed) def standard_list(self, data): - try: items = Trakt[requests.utils.urlparse(data).path].items() - except AttributeError: items = None - if items is None: raise Failed("Trakt Error: No List found") - else: return items + try: trakt_list = Trakt[requests.utils.urlparse(data).path].get() + except AttributeError: trakt_list = None + if trakt_list is None: raise Failed("Trakt Error: No List found") + else: return trakt_list def validate_trakt_list(self, values): trakt_values = [] @@ -145,7 +145,7 @@ class TraktAPI: logger.info(f"Processing {pretty}: {data} {media_type}{'' if data == 1 else 's'}") else: if method == "trakt_watchlist": trakt_items = self.watchlist(data, is_movie) - elif method == "trakt_list": trakt_items = self.standard_list(data) + elif method == "trakt_list": trakt_items = self.standard_list(data).items() else: raise Failed(f"Trakt Error: Method {method} not supported") if status_message: logger.info(f"Processing {pretty}: {data}") show_ids = []