From 3bf4756b448bb0a3db5467f1cce9896f9d32df1c Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 27 Feb 2023 15:10:06 -0500 Subject: [PATCH] [104] fix dynamic collection labels --- VERSION | 2 +- modules/builder.py | 16 ++++++++++++++-- modules/meta.py | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 0034a0ee..604967b6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.3-develop103 +1.18.3-develop104 diff --git a/modules/builder.py b/modules/builder.py index fbcbb9bc..4a7533d7 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -5,7 +5,7 @@ from modules import anidb, anilist, flixpatrol, icheckmovies, imdb, letterboxd, from modules.util import Failed, FilterFailed, NonExisting, NotScheduled, NotScheduledRange, Deleted from modules.overlay import Overlay from plexapi.audio import Artist, Album, Track -from plexapi.exceptions import BadRequest, NotFound +from plexapi.exceptions import NotFound from plexapi.video import Movie, Show, Season, Episode from requests.exceptions import ConnectionError from urllib.parse import quote @@ -44,7 +44,7 @@ ignored_details = [ "delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "builder_level", "overlay", "validate_builders", "libraries", "sync_to_users", "exclude_users", "collection_name", "playlist_name", "name", "blank_collection", "allowed_library_types", "run_definition", "delete_playlist", "ignore_blank_results", "only_run_on_create", - "delete_collections_named", "tmdb_person_offset" + "delete_collections_named", "tmdb_person_offset", "append_label" ] details = [ "ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "collection_filtering", "collection_mode", "limit", "url_theme", @@ -834,6 +834,18 @@ class CollectionBuilder: else: logger.error(e) + if "append_label" in methods and not self.playlist and not self.overlay: + logger.debug("") + logger.debug("Validating Method: append_label") + logger.debug(f"Value: {data[methods['append_label']]}") + append_labels = util.get_list(data[methods["append_label"]]) + if "label.sync" in self.details: + self.details["label.sync"].extend(append_labels) + elif "label" in self.details: + self.details["label"].extend(append_labels) + else: + self.details["label"] = append_labels + if not self.server_preroll and not self.smart_url and not self.blank_collection and len(self.builders) == 0: raise Failed(f"{self.Type} Error: No builders were found") diff --git a/modules/meta.py b/modules/meta.py index 3007c31b..474e2076 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -1013,7 +1013,7 @@ class MetadataFile(DataFile): if collection_title in col_names: logger.warning(f"Config Warning: Skipping duplicate collection: {collection_title}") else: - col = {"template": template_call, "label": str(map_name)} + col = {"template": template_call, "append_label": str(map_name)} if test: col["test"] = True if collection_title in sync: @@ -1041,7 +1041,7 @@ class MetadataFile(DataFile): new_call = og_other.copy() new_call["name"] = other_template other_call.append(new_call) - col = {"template": other_call, "label": str(map_name)} + col = {"template": other_call, "append_label": str(map_name)} if test: col["test"] = True if other_name in sync: