From ff0def506556400760bd8046c314aaca1e9609f5 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 10 May 2022 09:56:29 -0400 Subject: [PATCH] [80] preserve capitalization for tags --- VERSION | 2 +- modules/builder.py | 7 +++---- modules/meta.py | 8 ++++---- modules/operations.py | 4 ++-- modules/plex.py | 8 ++++---- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index ca15619a..055a08e4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop79 +1.16.5-develop80 diff --git a/modules/builder.py b/modules/builder.py index 48777fec..e25cf3c0 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -2369,10 +2369,9 @@ class CollectionBuilder: if "non_item_remove_label" in self.item_details: rk_compare = [item.ratingKey for item in self.items] - for remove_label in self.item_details["non_item_remove_label"]: - for non_item in self.library.search(label=remove_label, libtype=self.collection_level): - if non_item.ratingKey not in rk_compare: - self.library.edit_tags("label", non_item, remove_tags=[remove_label]) + for non_item in self.library.search(label=self.item_details["non_item_remove_label"], libtype=self.collection_level): + if non_item.ratingKey not in rk_compare: + self.library.edit_tags("label", non_item, remove_tags=self.item_details["non_item_remove_label"]) tmdb_paths = [] tvdb_paths = [] diff --git a/modules/meta.py b/modules/meta.py index 549ab927..1ed9a414 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -637,18 +637,18 @@ class MetadataFile(DataFile): logger.error(f"Metadata Error: Cannot use {attr} and {attr}.sync together") elif f"{attr}.remove" in alias and f"{attr}.sync" in alias: logger.error(f"Metadata Error: Cannot use {attr}.remove and {attr}.sync together") - elif attr in alias and group[alias[attr]] is None: + elif attr in alias and not group[alias[attr]]: logger.error(f"Metadata Error: {attr} attribute is blank") - elif f"{attr}.remove" in alias and group[alias[f"{attr}.remove"]] is None: + elif f"{attr}.remove" in alias and not group[alias[f"{attr}.remove"]]: logger.error(f"Metadata Error: {attr}.remove attribute is blank") - elif f"{attr}.sync" in alias and group[alias[f"{attr}.sync"]] is None: + elif f"{attr}.sync" in alias and not group[alias[f"{attr}.sync"]]: logger.error(f"Metadata Error: {attr}.sync attribute is blank") elif attr in alias or f"{attr}.remove" in alias or f"{attr}.sync" in alias: add_tags = util.get_list(group[alias[attr]]) if attr in alias else [] if extra: add_tags.extend(extra) remove_tags = util.get_list(group[alias[f"{attr}.remove"]]) if f"{attr}.remove" in alias else None - sync_tags = util.get_list(group[alias[f"{attr}.sync"]] if group[alias[f"{attr}.sync"]] else []) if f"{attr}.sync" in alias else None + sync_tags = util.get_list(group[alias[f"{attr}.sync"]]) if f"{attr}.sync" in alias else None return len(self.library.edit_tags(attr, obj, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags)) > 0 return False diff --git a/modules/operations.py b/modules/operations.py index 9f0d49d5..1ca7afa4 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -159,7 +159,7 @@ class Operations: add_labels = [la for la in parental_labels if la not in current_labels] remove_labels = [la for la in current_labels if la in util.parental_labels and la not in parental_labels] if add_labels or remove_labels: - batch_display += f"\n{self.library.edit_tags('label', item, add_tags=add_labels, remove_tags=remove_labels)}" + batch_display += f"\n{self.library.edit_tags('label', item, add_tags=add_labels, remove_tags=remove_labels, do_print=False)}" except Failed: pass @@ -297,7 +297,7 @@ class Operations: else: mapped_genres.append(genre) new_genres = mapped_genres - batch_display += f"\n{self.library.edit_tags('genre', item, sync_tags=new_genres)}" + batch_display += f"\n{self.library.edit_tags('genre', item, sync_tags=new_genres, do_print=False)}" except Failed: pass diff --git a/modules/plex.py b/modules/plex.py index 0b52fa91..0bbfe174 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -867,14 +867,14 @@ class Plex(Library): attr_call = attr_display.replace(" ", "") if add_tags or remove_tags or sync_tags is not None: _add_tags = add_tags if add_tags else [] - _remove_tags = [t.lower() for t in remove_tags] if remove_tags else [] - _sync_tags = [t.lower() for t in sync_tags] if sync_tags else [] + _remove_tags = remove_tags if remove_tags else [] + _sync_tags = sync_tags if sync_tags else [] try: obj = self.reload(obj) - _item_tags = [item_tag.tag.lower() for item_tag in getattr(obj, key)] + _item_tags = [item_tag.tag for item_tag in getattr(obj, key)] except BadRequest: _item_tags = [] - _add = [f"{t[:1].upper()}{t[1:]}" for t in _add_tags + _sync_tags if t.lower() not in _item_tags] + _add = [t for t in _add_tags + _sync_tags if t not in _item_tags] _remove = [t for t in _item_tags if (sync_tags is not None and t not in _sync_tags) or t in _remove_tags] if _add: self.query_data(getattr(obj, f"add{attr_call}"), _add)