From 309f2d5fbfff501be3588992801abcabc50ac069 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 25 Oct 2021 11:40:49 -0400 Subject: [PATCH] #418 Added period to trakt_recommended, trakt_watched , and trakt_collected --- VERSION | 2 +- modules/builder.py | 5 +++-- modules/trakt.py | 11 +++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 11614fd0..54461f87 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.12.2-develop1020 \ No newline at end of file +1.12.2-develop1025 \ No newline at end of file diff --git a/modules/builder.py b/modules/builder.py index 92ad48b1..8d0764de 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -41,7 +41,8 @@ method_alias = { "seasonyear": "year", "isadult": "adult", "startdate": "start", "enddate": "end", "averagescore": "score", "minimum_tag_percentage": "min_tag_percent", "minimumtagrank": "min_tag_percent", "minimum_tag_rank": "min_tag_percent", "anilist_tag": "anilist_search", "anilist_genre": "anilist_search", "anilist_season": "anilist_search", - "mal_producer": "mal_studio", "mal_licensor": "mal_studio" + "mal_producer": "mal_studio", "mal_licensor": "mal_studio", + "trakt_recommended": "trakt_recommended_weekly", "trakt_watched": "trakt_watched_weekly", "trakt_collected": "trakt_collected_weekly" } filter_translation = { "actor": "actors", @@ -1027,7 +1028,7 @@ class CollectionBuilder: self.builders.append(("trakt_list", trakt_list)) if method_name.endswith("_details"): self.summaries[method_name] = self.config.Trakt.list_description(trakt_lists[0]) - elif method_name in ["trakt_trending", "trakt_popular", "trakt_recommended", "trakt_watched", "trakt_collected"]: + elif method_name.startswith(("trakt_trending", "trakt_popular", "trakt_recommended", "trakt_watched", "trakt_collected")): self.builders.append((method_name, util.parse(method_name, method_data, datatype="int", default=10))) elif method_name in ["trakt_watchlist", "trakt_collection"]: for trakt_list in self.config.Trakt.validate_trakt(method_data, self.library.is_movie, trakt_type=method_name[6:]): diff --git a/modules/trakt.py b/modules/trakt.py index 1bec27c6..899fd2f1 100644 --- a/modules/trakt.py +++ b/modules/trakt.py @@ -9,8 +9,10 @@ redirect_uri = "urn:ietf:wg:oauth:2.0:oob" redirect_uri_encoded = redirect_uri.replace(":", "%3A") base_url = "https://api.trakt.tv" builders = [ - "trakt_collected", "trakt_collection", "trakt_list", "trakt_list_details", "trakt_popular", - "trakt_recommended", "trakt_trending", "trakt_watched", "trakt_watchlist" + "trakt_collected_daily", "trakt_collected_weekly", "trakt_collected_monthly", "trakt_collected_yearly", "trakt_collected_all", + "trakt_recommended_daily", "trakt_recommended_weekly", "trakt_recommended_monthly", "trakt_recommended_yearly", "trakt_recommended_all", + "trakt_watched_daily", "trakt_watched_weekly", "trakt_watched_monthly", "trakt_watched_yearly", "trakt_watched_all", + "trakt_collection", "trakt_list", "trakt_list_details", "trakt_popular", "trakt_trending", "trakt_watchlist" ] sorts = [ "rank", "added", "title", "released", "runtime", "popularity", @@ -216,9 +218,10 @@ class Trakt: def get_trakt_ids(self, method, data, is_movie): pretty = method.replace("_", " ").title() media_type = "Movie" if is_movie else "Show" - if method in ["trakt_trending", "trakt_popular", "trakt_recommended", "trakt_watched", "trakt_collected"]: + if method.startswith(("trakt_trending", "trakt_popular", "trakt_recommended", "trakt_watched", "trakt_collected")): logger.info(f"Processing {pretty}: {data} {media_type}{'' if data == 1 else 's'}") - return self._pagenation(method[6:], data, is_movie) + terms = method.split("_") + return self._pagenation(f"{terms[1]}{f'/{terms[2]}' if len(terms) > 2 else ''}", data, is_movie) elif method in ["trakt_collection", "trakt_watchlist"]: logger.info(f"Processing {pretty} {media_type}s for {data}") return self._user_items(method[6:], data, is_movie)