From 92912c9d8964bd8475f6927ea40b3798a681a4c6 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sat, 2 Apr 2022 10:17:47 -0400 Subject: [PATCH] [1] added other template with some fixes --- VERSION | 2 +- docs/metadata/builders/trakt.md | 10 +++++----- modules/builder.py | 4 ++-- modules/meta.py | 15 +++++++++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/VERSION b/VERSION index c807441c..7e13abdf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.3 +1.16.3-develop1 diff --git a/docs/metadata/builders/trakt.md b/docs/metadata/builders/trakt.md index 0207723c..8501311c 100644 --- a/docs/metadata/builders/trakt.md +++ b/docs/metadata/builders/trakt.md @@ -112,11 +112,11 @@ Finds every movie/show in the Trakt Userlist. The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. -| Attribute | Description & Values | -|:-----------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `userlist` | **Description:** Which Trakt userlist to query
**Values:**
`trending`Trakt's Trending [Movies](https://trakt.tv/movies/trending)/[Shows](https://trakt.tv/shows/trending) list
`popular`Trakt's Popular [Movies](https://trakt.tv/movies/popular)/[Shows](https://trakt.tv/shows/popular) list
`recommended`Trakt's Recommended [Movies](https://trakt.tv/movies/recommended)/[Shows](https://trakt.tv/shows/recommended) list
`watched`Trakt's Watched [Movies](https://trakt.tv/movies/watched)/[Shows](https://trakt.tv/shows/watched) list
`collected`Trakt's Collected [Movies](https://trakt.tv/movies/collected)/[Shows](https://trakt.tv/shows/collected) list
| -| `user` | **Description:** The User who's user lists you want to query.
**Default:** `me`
**Values:** Username of User or `me` for the authenticated user. | -| `sort_by` | **Description:** How to sort the results
**Default:** `rank`
**Values:** `rank`, `added`, `released`, `title` | +| Attribute | Description & Values | +|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `userlist` | **Description:** Which Trakt userlist to query
**Values:**
`watchlist`Trakt User's Watchlist
`recommended`Trakt User's Personal Recommended list
`watched`Trakt User's Personal Watched list
`collected`Trakt User's Personal Collected list
| +| `user` | **Description:** The User who's user lists you want to query.
**Default:** `me`
**Values:** Username of User or `me` for the authenticated user. | +| `sort_by` | **Description:** How to sort the results
**Default:** `rank`
**Values:** `rank`, `added`, `released`, `title` | ```yaml collections: diff --git a/modules/builder.py b/modules/builder.py index ccc147ee..0aff35da 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -476,7 +476,7 @@ class CollectionBuilder: raise Failed(f"{self.Type} Error: No valid TMDb Person IDs in {self.data[methods['tmdb_person']]}") self.smart_filter_details = "" - self.smart_label = {"sort_by": "random", "all": {"label": self.name}} + self.smart_label = {"sort_by": "random", "all": {"label": [self.name]}} self.smart_label_collection = False if "smart_label" in methods and not self.playlist and not self.library.is_music: logger.debug("") @@ -1291,7 +1291,7 @@ class CollectionBuilder: terms = method_name.split("_") trakt_dicts = { "chart": terms[1], - "amount": util.parse(self.Type, method_name, method_data, datatype="int", default=10), + "limit": util.parse(self.Type, method_name, method_data, datatype="int", default=10), "time_period": terms[2] if len(terms) > 2 else None } final_method = "trakt_chart" diff --git a/modules/meta.py b/modules/meta.py index 400773a1..bcfa3be8 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -271,7 +271,7 @@ class MetadataFile(DataFile): exclude = [str(e) for e in og_exclude] for k, v in addons.items(): if k in v: - raise Failed(f"Config Warning: {k} cannot be an addon for itself") + logger.warning(f"Config Warning: {k} cannot be an addon for itself") exclude.extend([y for y in v if y != k and y not in exclude]) default_title_format = "<>" default_template = None @@ -320,7 +320,7 @@ class MetadataFile(DataFile): default_template = {"smart_filter": {"sort_by": "title.asc", "any": {auto_type: f"<>"}}} default_title_format = "<> <>s" else: - default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {auto_type: f"<>"}}} + default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {f"{auto_type}.is" if auto_type == "studio" else auto_type: "<>"}}} default_title_format = "Best <>s of <>" if auto_type in ["year", "decade"] else "Top <> <>s" elif auto_type == "tmdb_collection": all_items = library.get_all() @@ -455,6 +455,11 @@ class MetadataFile(DataFile): remove_suffix = util.parse("Config", "remove_suffix", dynamic, parent=map_name, methods=methods, datatype="commalist") if "remove_suffix" in methods else [] sync = {i.title: i for i in self.library.search(libtype="collection", label=str(map_name))} if sync else {} other_name = util.parse("Config", "other_name", dynamic, parent=map_name, methods=methods) if "other_name" in methods and include else None + other_template = util.parse("Config", "other_template", dynamic, parent=map_name, methods=methods) if "other_template" in methods and include else None + if other_template and other_template not in self.templates: + raise Failed(f"Config Error: {map_name} other template: {other_template} not found") + else: + other_template = template_name other_keys = [] logger.debug(f"Mapping Name: {map_name}") logger.debug(f"Type: {auto_type}") @@ -462,6 +467,7 @@ class MetadataFile(DataFile): logger.debug(f"Exclude: {exclude}") logger.debug(f"Addons: {addons}") logger.debug(f"Template: {template_name}") + logger.debug(f"Other Template: {other_template}") logger.debug(f"Template Variables: {template_variables}") logger.debug(f"Remove Prefix: {remove_prefix}") logger.debug(f"Remove Suffix: {remove_suffix}") @@ -518,8 +524,9 @@ class MetadataFile(DataFile): self.collections[collection_title] = col if other_name: template_call = { - "name": template_name, + "name": other_template, "value": other_keys, + "included_keys": include, auto_type: other_keys, "key_name": other_name, "key": "other" } @@ -991,7 +998,7 @@ class MetadataFile(DataFile): races = self.config.Ergast.get_races(f1_season, f1_language) race_lookup = {r.round: r for r in races} for season in item.seasons(): - if season.seasonNumber is 0: + if not season.seasonNumber: continue sprint_weekend = False for episode in season.episodes():