Merge pull request #333 from meisnate12/develop

v1.11.3
pull/384/head v1.11.3
meisnate12 4 years ago committed by GitHub
commit 54876e9d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1092,6 +1092,7 @@ class CollectionBuilder:
for item in self.library.get_collection_items(self.obj, self.smart_label_collection): for item in self.library.get_collection_items(self.obj, self.smart_label_collection):
self.plex_map[item.ratingKey] = item self.plex_map[item.ratingKey] = item
else: else:
self.obj = None
self.sync = False self.sync = False
self.run_again = False self.run_again = False
logger.info("") logger.info("")

@ -750,23 +750,22 @@ class Plex:
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 = add_tags if add_tags else [] _add_tags = add_tags if add_tags else []
_remove = [t.lower() for t in remove_tags] if remove_tags else [] _remove_tags = remove_tags if remove_tags else []
_sync_tags = sync_tags if sync_tags else [] _sync_tags = sync_tags if sync_tags else []
_sync = [t.lower() for t in _sync_tags] try:
item_tags = [item_tag.tag.lower() for item_tag in getattr(obj, key)] _item_tags = [item_tag.tag.lower() for item_tag in getattr(obj, key)]
_add = _add_tags + _sync_tags 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]
_remove = [t for t in _item_tags if (_sync_tags and t not in _sync_tags) or t in _remove_tags]
if _add: if _add:
add = [f"{t[:1].upper()}{t[1:]}" for t in _add if t.lower() not in item_tags]
if add:
updated = True updated = True
self.query_data(getattr(obj, f"add{attr.capitalize()}"), add) self.query_data(getattr(obj, f"add{attr.capitalize()}"), _add)
logger.info(f"Detail: {attr.capitalize()} {add} added") logger.info(f"Detail: {attr.capitalize()} {_add} added")
if _remove or _sync: if _remove:
remove = [t for t in item_tags if t not in _sync or t in _remove]
if remove:
updated = True updated = True
self.query_data(getattr(obj, f"remove{attr.capitalize()}"), remove) self.query_data(getattr(obj, f"remove{attr.capitalize()}"), _remove)
logger.info(f"Detail: {attr.capitalize()} {remove} removed") logger.info(f"Detail: {attr.capitalize()} {_remove} removed")
return updated return updated
def update_item_from_assets(self, item, overlay=None): def update_item_from_assets(self, item, overlay=None):

@ -105,7 +105,7 @@ def start(config_path, is_test=False, time_scheduled=None, requested_collections
logger.info(util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ")) logger.info(util.centered("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | "))
logger.info(util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ")) logger.info(util.centered("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| "))
logger.info(util.centered(" |___/ ")) logger.info(util.centered(" |___/ "))
logger.info(util.centered(" Version: 1.11.2 ")) logger.info(util.centered(" Version: 1.11.3 "))
if time_scheduled: start_type = f"{time_scheduled} " if time_scheduled: start_type = f"{time_scheduled} "
elif is_test: start_type = "Test " elif is_test: start_type = "Test "
elif requested_collections: start_type = "Collections " elif requested_collections: start_type = "Collections "

Loading…
Cancel
Save