[80] preserve capitalization for tags

pull/865/head
meisnate12 3 years ago
parent 4c9509c5a9
commit ff0def5065

@ -1 +1 @@
1.16.5-develop79
1.16.5-develop80

@ -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 = []

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

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

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

Loading…
Cancel
Save