From be22731d029cbc188bf2c3e3d8f005e091f5ea6b Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sun, 10 Apr 2022 11:31:22 -0400 Subject: [PATCH] [19] fix genres --- VERSION | 2 +- plex_meta_manager.py | 51 ++++++++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/VERSION b/VERSION index 1234f22b..d381e54e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.3-develop18 +1.16.3-develop19 diff --git a/plex_meta_manager.py b/plex_meta_manager.py index cc702d50..d17e1b0c 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -612,30 +612,35 @@ def library_operations(config, library): raise Failed if library.mass_genre_update or library.genre_mapper: - new_genres = [] - if library.mass_genre_update: - if tmdb_item and library.mass_genre_update == "tmdb": - new_genres = tmdb_item.genres - elif omdb_item and library.mass_genre_update == "omdb": - new_genres = omdb_item.genres - elif tvdb_item and library.mass_genre_update == "tvdb": - new_genres = tvdb_item.genres - elif anidb_item and library.mass_genre_update == "anidb": - new_genres = anidb_item.tags - if not new_genres: - logger.info(f"{item.title[:25]:<25} | No Genres Found") - if library.genre_mapper: - if not new_genres: - new_genres = [g.tag for g in item.genres] - mapped_genres = [] - for genre in new_genres: - if genre in library.genre_mapper: - if library.genre_mapper[genre]: - mapped_genres.append(library.genre_mapper[genre]) + try: + new_genres = [] + if library.mass_genre_update: + if tmdb_item and library.mass_genre_update == "tmdb": + new_genres = tmdb_item.genres + elif omdb_item and library.mass_genre_update == "omdb": + new_genres = omdb_item.genres + elif tvdb_item and library.mass_genre_update == "tvdb": + new_genres = tvdb_item.genres + elif anidb_item and library.mass_genre_update == "anidb": + new_genres = anidb_item.tags else: - mapped_genres.append(genre) - new_genres = mapped_genres - batch_display += f"\n{library.edit_tags('genre', item, sync_tags=new_genres)}" + raise Failed + if not new_genres: + logger.info(f"{item.title[:25]:<25} | No Genres Found") + if library.genre_mapper: + if not new_genres: + new_genres = [g.tag for g in item.genres] + mapped_genres = [] + for genre in new_genres: + if genre in library.genre_mapper: + if library.genre_mapper[genre]: + mapped_genres.append(library.genre_mapper[genre]) + else: + mapped_genres.append(genre) + new_genres = mapped_genres + batch_display += f"\n{library.edit_tags('genre', item, sync_tags=new_genres)}" + except Failed: + pass if library.mass_audience_rating_update: try: