[104] fix dynamic collection labels

pull/1328/head
meisnate12 2 years ago
parent f0f6c01d4e
commit 3bf4756b44

@ -1 +1 @@
1.18.3-develop103 1.18.3-develop104

@ -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.util import Failed, FilterFailed, NonExisting, NotScheduled, NotScheduledRange, Deleted
from modules.overlay import Overlay from modules.overlay import Overlay
from plexapi.audio import Artist, Album, Track 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 plexapi.video import Movie, Show, Season, Episode
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
from urllib.parse import quote from urllib.parse import quote
@ -44,7 +44,7 @@ ignored_details = [
"delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "builder_level", "overlay", "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", "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", "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 = [ details = [
"ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "collection_filtering", "collection_mode", "limit", "url_theme", "ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "collection_filtering", "collection_mode", "limit", "url_theme",
@ -834,6 +834,18 @@ class CollectionBuilder:
else: else:
logger.error(e) 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: 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") raise Failed(f"{self.Type} Error: No builders were found")

@ -1013,7 +1013,7 @@ class MetadataFile(DataFile):
if collection_title in col_names: if collection_title in col_names:
logger.warning(f"Config Warning: Skipping duplicate collection: {collection_title}") logger.warning(f"Config Warning: Skipping duplicate collection: {collection_title}")
else: else:
col = {"template": template_call, "label": str(map_name)} col = {"template": template_call, "append_label": str(map_name)}
if test: if test:
col["test"] = True col["test"] = True
if collection_title in sync: if collection_title in sync:
@ -1041,7 +1041,7 @@ class MetadataFile(DataFile):
new_call = og_other.copy() new_call = og_other.copy()
new_call["name"] = other_template new_call["name"] = other_template
other_call.append(new_call) other_call.append(new_call)
col = {"template": other_call, "label": str(map_name)} col = {"template": other_call, "append_label": str(map_name)}
if test: if test:
col["test"] = True col["test"] = True
if other_name in sync: if other_name in sync:

Loading…
Cancel
Save