[104] fix dynamic collection labels

This commit is contained in:
meisnate12 2023-02-27 15:10:06 -05:00
parent f0f6c01d4e
commit 3bf4756b44
3 changed files with 17 additions and 5 deletions

View file

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

View file

@ -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")

View file

@ -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: