[1] added other template with some fixes

pull/847/head
meisnate12 3 years ago
parent 5b270dc41a
commit 92912c9d89

@ -1 +1 @@
1.16.3 1.16.3-develop1

@ -113,8 +113,8 @@ 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. 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 | | Attribute | Description & Values |
|:-----------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `userlist` | **Description:** Which Trakt userlist to query<br>**Values:**<table class="clearTable"><tr><td>`trending`</td><td>Trakt's Trending [Movies](https://trakt.tv/movies/trending)/[Shows](https://trakt.tv/shows/trending) list</td></tr><tr><td>`popular`</td><td>Trakt's Popular [Movies](https://trakt.tv/movies/popular)/[Shows](https://trakt.tv/shows/popular) list</td></tr><tr><td>`recommended`</td><td>Trakt's Recommended [Movies](https://trakt.tv/movies/recommended)/[Shows](https://trakt.tv/shows/recommended) list</td></tr><tr><td>`watched`</td><td>Trakt's Watched [Movies](https://trakt.tv/movies/watched)/[Shows](https://trakt.tv/shows/watched) list</td></tr><tr><td>`collected`</td><td>Trakt's Collected [Movies](https://trakt.tv/movies/collected)/[Shows](https://trakt.tv/shows/collected) list</td></tr></table> | | `userlist` | **Description:** Which Trakt userlist to query<br>**Values:**<table class="clearTable"><tr><td>`watchlist`</td><td>Trakt User's Watchlist</td></tr><tr><td>`recommended`</td><td>Trakt User's Personal Recommended list</td></tr><tr><td>`watched`</td><td>Trakt User's Personal Watched list</td></tr><tr><td>`collected`</td><td>Trakt User's Personal Collected list</td></tr></table> |
| `user` | **Description:** The User who's user lists you want to query.<br>**Default:** `me`<br>**Values:** Username of User or `me` for the authenticated user. | | `user` | **Description:** The User who's user lists you want to query.<br>**Default:** `me`<br>**Values:** Username of User or `me` for the authenticated user. |
| `sort_by` | **Description:** How to sort the results<br>**Default:** `rank`<br>**Values:** `rank`, `added`, `released`, `title` | | `sort_by` | **Description:** How to sort the results<br>**Default:** `rank`<br>**Values:** `rank`, `added`, `released`, `title` |

@ -476,7 +476,7 @@ class CollectionBuilder:
raise Failed(f"{self.Type} Error: No valid TMDb Person IDs in {self.data[methods['tmdb_person']]}") raise Failed(f"{self.Type} Error: No valid TMDb Person IDs in {self.data[methods['tmdb_person']]}")
self.smart_filter_details = "" 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 self.smart_label_collection = False
if "smart_label" in methods and not self.playlist and not self.library.is_music: if "smart_label" in methods and not self.playlist and not self.library.is_music:
logger.debug("") logger.debug("")
@ -1291,7 +1291,7 @@ class CollectionBuilder:
terms = method_name.split("_") terms = method_name.split("_")
trakt_dicts = { trakt_dicts = {
"chart": terms[1], "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 "time_period": terms[2] if len(terms) > 2 else None
} }
final_method = "trakt_chart" final_method = "trakt_chart"

@ -271,7 +271,7 @@ class MetadataFile(DataFile):
exclude = [str(e) for e in og_exclude] exclude = [str(e) for e in og_exclude]
for k, v in addons.items(): for k, v in addons.items():
if k in v: 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]) exclude.extend([y for y in v if y != k and y not in exclude])
default_title_format = "<<key_name>>" default_title_format = "<<key_name>>"
default_template = None default_template = None
@ -320,7 +320,7 @@ class MetadataFile(DataFile):
default_template = {"smart_filter": {"sort_by": "title.asc", "any": {auto_type: f"<<value>>"}}} default_template = {"smart_filter": {"sort_by": "title.asc", "any": {auto_type: f"<<value>>"}}}
default_title_format = "<<key_name>> <<library_type>>s" default_title_format = "<<key_name>> <<library_type>>s"
else: else:
default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {auto_type: f"<<value>>"}}} default_template = {"smart_filter": {"limit": 50, "sort_by": "critic_rating.desc", "any": {f"{auto_type}.is" if auto_type == "studio" else auto_type: "<<value>>"}}}
default_title_format = "Best <<library_type>>s of <<key_name>>" if auto_type in ["year", "decade"] else "Top <<key_name>> <<library_type>>s" default_title_format = "Best <<library_type>>s of <<key_name>>" if auto_type in ["year", "decade"] else "Top <<key_name>> <<library_type>>s"
elif auto_type == "tmdb_collection": elif auto_type == "tmdb_collection":
all_items = library.get_all() 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 [] 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 {} 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_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 = [] other_keys = []
logger.debug(f"Mapping Name: {map_name}") logger.debug(f"Mapping Name: {map_name}")
logger.debug(f"Type: {auto_type}") logger.debug(f"Type: {auto_type}")
@ -462,6 +467,7 @@ class MetadataFile(DataFile):
logger.debug(f"Exclude: {exclude}") logger.debug(f"Exclude: {exclude}")
logger.debug(f"Addons: {addons}") logger.debug(f"Addons: {addons}")
logger.debug(f"Template: {template_name}") logger.debug(f"Template: {template_name}")
logger.debug(f"Other Template: {other_template}")
logger.debug(f"Template Variables: {template_variables}") logger.debug(f"Template Variables: {template_variables}")
logger.debug(f"Remove Prefix: {remove_prefix}") logger.debug(f"Remove Prefix: {remove_prefix}")
logger.debug(f"Remove Suffix: {remove_suffix}") logger.debug(f"Remove Suffix: {remove_suffix}")
@ -518,8 +524,9 @@ class MetadataFile(DataFile):
self.collections[collection_title] = col self.collections[collection_title] = col
if other_name: if other_name:
template_call = { template_call = {
"name": template_name, "name": other_template,
"value": other_keys, "value": other_keys,
"included_keys": include,
auto_type: other_keys, auto_type: other_keys,
"key_name": other_name, "key": "other" "key_name": other_name, "key": "other"
} }
@ -991,7 +998,7 @@ class MetadataFile(DataFile):
races = self.config.Ergast.get_races(f1_season, f1_language) races = self.config.Ergast.get_races(f1_season, f1_language)
race_lookup = {r.round: r for r in races} race_lookup = {r.round: r for r in races}
for season in item.seasons(): for season in item.seasons():
if season.seasonNumber is 0: if not season.seasonNumber:
continue continue
sprint_weekend = False sprint_weekend = False
for episode in season.episodes(): for episode in season.episodes():

Loading…
Cancel
Save