From 1d55e5ca9a633d40bcac65907b9f720703d30cb2 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 2 Jul 2021 22:14:36 -0400 Subject: [PATCH] #313 added split_duplicates which splits all duplicates --- modules/config.py | 5 +++++ modules/plex.py | 3 ++- plex_meta_manager.py | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/config.py b/modules/config.py index 77519af0..3cda86a6 100644 --- a/modules/config.py +++ b/modules/config.py @@ -403,6 +403,11 @@ class Config: else: params["mass_critic_rating_update"] = None + if lib and "split_duplicates" in lib and lib["split_duplicates"]: + params["split_duplicates"] = check_for_attribute(lib, "split_duplicates", var_type="bool", default=False, save=False) + else: + params["split_duplicates"] = None + if lib and "radarr_add_all" in lib and lib["radarr_add_all"]: params["radarr_add_all"] = check_for_attribute(lib, "radarr_add_all", var_type="bool", default=False, save=False) else: diff --git a/modules/plex.py b/modules/plex.py index 8cbf629d..2d5975ab 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -318,9 +318,10 @@ class Plex: self.mass_genre_update = params["mass_genre_update"] self.mass_audience_rating_update = params["mass_audience_rating_update"] self.mass_critic_rating_update = params["mass_critic_rating_update"] + self.split_duplicates = params["split_duplicates"] self.radarr_add_all = params["radarr_add_all"] self.sonarr_add_all = params["sonarr_add_all"] - self.mass_update = self.mass_genre_update or self.mass_audience_rating_update or self.mass_critic_rating_update or self.radarr_add_all or self.sonarr_add_all + self.mass_update = self.mass_genre_update or self.mass_audience_rating_update or self.mass_critic_rating_update or self.split_duplicates or self.radarr_add_all or self.sonarr_add_all self.plex = params["plex"] self.url = params["plex"]["url"] self.token = params["plex"]["token"] diff --git a/plex_meta_manager.py b/plex_meta_manager.py index dbb0dd7b..7a7ab565 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -249,6 +249,11 @@ def mass_metadata(config, library): logger.info("") util.separator(f"Mass Editing {'Movie' if library.is_movie else 'Show'} Library: {library.name}") logger.info("") + if library.split_duplicates: + items = library.search(**{"duplicate": True}) + for item in items: + item.split() + logger.info(util.adjust_space(f"{item.title[:25]:<25} | Splitting")) radarr_adds = [] sonarr_adds = [] items = library.get_all()