mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-22 12:33:10 +00:00
update sync labels
This commit is contained in:
parent
975ce56b18
commit
ddc81cde11
2 changed files with 7 additions and 18 deletions
|
@ -746,7 +746,7 @@ class Plex:
|
|||
return False
|
||||
|
||||
def edit_tags(self, attr, obj, add_tags=None, remove_tags=None, sync_tags=None):
|
||||
updated = False
|
||||
display = ""
|
||||
key = builder.filter_translation[attr] if attr in builder.filter_translation else attr
|
||||
if add_tags or remove_tags or sync_tags:
|
||||
_add_tags = add_tags if add_tags else []
|
||||
|
@ -760,14 +760,14 @@ class Plex:
|
|||
_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:
|
||||
updated = True
|
||||
self.query_data(getattr(obj, f"add{attr.capitalize()}"), _add)
|
||||
logger.info(f"Detail: {attr.capitalize()} {','.join(_add)} added to {obj.title}")
|
||||
display += f"+{', +'.join(_add)}"
|
||||
if _remove:
|
||||
updated = True
|
||||
self.query_data(getattr(obj, f"remove{attr.capitalize()}"), _remove)
|
||||
logger.info(f"Detail: {attr.capitalize()} {','.join(_remove)} removed to {obj.title}")
|
||||
return updated
|
||||
display += f"-{', -'.join(_remove)}"
|
||||
if len(display) > 0:
|
||||
logger.info(f"{obj.title[:25]:<25} | {attr.capitalize()} | {display}")
|
||||
return len(display) > 0
|
||||
|
||||
def update_item_from_assets(self, item, overlay=None, create=False):
|
||||
name = os.path.basename(os.path.dirname(str(item.locations[0])) if self.is_movie else str(item.locations[0]))
|
||||
|
|
|
@ -366,18 +366,7 @@ def mass_metadata(config, library, items):
|
|||
new_genres = tvdb_item.genres
|
||||
else:
|
||||
raise Failed
|
||||
item_genres = [genre.tag for genre in item.genres]
|
||||
display_str = ""
|
||||
add_genre = [genre for genre in (g for g in new_genres if g not in item_genres)]
|
||||
if len(add_genre) > 0:
|
||||
display_str += f"+{', +'.join(add_genre)}"
|
||||
library.query_data(item.addGenre, add_genre)
|
||||
remove_genre = [genre for genre in (g for g in item_genres if g not in new_genres)]
|
||||
if len(remove_genre) > 0:
|
||||
display_str += f"-{', -'.join(remove_genre)}"
|
||||
library.query_data(item.removeGenre, remove_genre)
|
||||
if len(display_str) > 0:
|
||||
logger.info(util.adjust_space(f"{item.title[:25]:<25} | Genres | {display_str}"))
|
||||
library.edit_tags("genre", item, sync_tags=new_genres)
|
||||
except Failed:
|
||||
pass
|
||||
if library.mass_audience_rating_update:
|
||||
|
|
Loading…
Reference in a new issue