|
|
@ -698,29 +698,24 @@ class Plex:
|
|
|
|
updated = False
|
|
|
|
updated = False
|
|
|
|
key = builder.filter_translation[attr] if attr in builder.filter_translation else attr
|
|
|
|
key = builder.filter_translation[attr] if attr in builder.filter_translation else attr
|
|
|
|
if add_tags or remove_tags or sync_tags:
|
|
|
|
if add_tags or remove_tags or sync_tags:
|
|
|
|
_add_tags = [f"{t[:1].upper()}{t[1:]}" for t in add_tags] if add_tags else None
|
|
|
|
_add_tags = add_tags if add_tags else []
|
|
|
|
_remove_tags = [f"{t[:1].upper()}{t[1:]}" for t in remove_tags] if remove_tags else None
|
|
|
|
_remove = [t.lower() for t in remove_tags] if remove_tags else []
|
|
|
|
_sync_tags = [t.lower() for t in sync_tags] if sync_tags else None
|
|
|
|
_sync_tags = sync_tags if sync_tags else []
|
|
|
|
item_tags = [item_tag.tag for item_tag in getattr(obj, key)]
|
|
|
|
_sync = [t.lower() for t in _sync_tags]
|
|
|
|
input_tags = []
|
|
|
|
item_tags = [item_tag.tag.lower() for item_tag in getattr(obj, key)]
|
|
|
|
if _add_tags:
|
|
|
|
_add = _add_tags + _sync_tags
|
|
|
|
input_tags.extend(_add_tags)
|
|
|
|
if _add:
|
|
|
|
if _sync_tags:
|
|
|
|
add = [f"{t[:1].upper()}{t[1:]}" for t in _add if t.lower() not in item_tags]
|
|
|
|
input_tags.extend(_sync_tags)
|
|
|
|
if add:
|
|
|
|
if _sync_tags or _remove_tags:
|
|
|
|
updated = True
|
|
|
|
remove_method = getattr(obj, f"remove{attr.capitalize()}")
|
|
|
|
self.query_data(getattr(obj, f"add{attr.capitalize()}"), add)
|
|
|
|
for tag in item_tags:
|
|
|
|
logger.info(f"Detail: {attr.capitalize()} {add} added")
|
|
|
|
if (_sync_tags and tag.lower() not in _sync_tags) or (_remove_tags and tag in _remove_tags):
|
|
|
|
if _remove or _sync:
|
|
|
|
updated = True
|
|
|
|
remove = [t for t in item_tags if t not in _sync or t in _remove]
|
|
|
|
self.query_data(remove_method, tag)
|
|
|
|
if remove:
|
|
|
|
logger.info(f"Detail: {attr.capitalize()} {tag} removed")
|
|
|
|
updated = True
|
|
|
|
if input_tags:
|
|
|
|
self.query_data(getattr(obj, f"remove{attr.capitalize()}"), remove)
|
|
|
|
add_method = getattr(obj, f"add{attr.capitalize()}")
|
|
|
|
logger.info(f"Detail: {attr.capitalize()} {remove} removed")
|
|
|
|
for tag in input_tags:
|
|
|
|
|
|
|
|
if tag not in item_tags:
|
|
|
|
|
|
|
|
updated = True
|
|
|
|
|
|
|
|
self.query_data(add_method, tag)
|
|
|
|
|
|
|
|
logger.info(f"Detail: {attr.capitalize()} {tag} added")
|
|
|
|
|
|
|
|
return updated
|
|
|
|
return updated
|
|
|
|
|
|
|
|
|
|
|
|
def update_item_from_assets(self, item):
|
|
|
|
def update_item_from_assets(self, item):
|
|
|
|