diff --git a/VERSION b/VERSION index 8812049d..e3ef2ef6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.15.1-develop47 +1.15.1-develop48 diff --git a/modules/config.py b/modules/config.py index c8e88604..7da26de1 100644 --- a/modules/config.py +++ b/modules/config.py @@ -559,7 +559,8 @@ class ConfigFile: "sonarr_remove_by_tag": None, "mass_collection_mode": None, "metadata_backup": None, - "genre_collections": None + "genre_collections": None, + "update_blank_track_titles": None } display_name = f"{params['name']} ({params['mapping_name']})" if lib and "library_name" in lib and lib["library_name"] else params["mapping_name"] @@ -638,6 +639,8 @@ class ConfigFile: params["sonarr_add_all_existing"] = check_for_attribute(lib["operations"], "sonarr_add_all_existing", var_type="bool", default=False, save=False) if "sonarr_remove_by_tag" in lib["operations"]: params["sonarr_remove_by_tag"] = check_for_attribute(lib["operations"], "sonarr_remove_by_tag", var_type="comma_list", default=False, save=False) + if "update_blank_track_titles" in lib["operations"]: + params["update_blank_track_titles"] = check_for_attribute(lib["operations"], "update_blank_track_titles", var_type="bool", default=False, save=False) if "mass_collection_mode" in lib["operations"]: try: params["mass_collection_mode"] = util.check_collection_mode(lib["operations"]["mass_collection_mode"]) diff --git a/modules/library.py b/modules/library.py index 409e262b..d3180924 100644 --- a/modules/library.py +++ b/modules/library.py @@ -75,6 +75,7 @@ class Library(ABC): self.radarr_remove_by_tag = params["radarr_remove_by_tag"] self.sonarr_add_all_existing = params["sonarr_add_all_existing"] self.sonarr_remove_by_tag = params["sonarr_remove_by_tag"] + self.update_blank_track_titles = params["update_blank_track_titles"] self.mass_collection_mode = params["mass_collection_mode"] self.metadata_backup = params["metadata_backup"] self.tmdb_collections = params["tmdb_collections"] @@ -94,7 +95,7 @@ class Library(ABC): or self.tmdb_collections or self.radarr_add_all_existing or self.sonarr_add_all_existing self.library_operation = self.items_library_operation or self.delete_unmanaged_collections or self.delete_collections_with_less \ or self.radarr_remove_by_tag or self.sonarr_remove_by_tag or self.mass_collection_mode \ - or self.genre_collections or self.show_unmanaged or self.metadata_backup + or self.genre_collections or self.show_unmanaged or self.metadata_backup or self.update_blank_track_titles if self.asset_directory: logger.info("") diff --git a/modules/plex.py b/modules/plex.py index 550dfd8e..16db4e45 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -415,6 +415,10 @@ class Plex(Library): self.is_other = self.agent == "com.plexapp.agents.none" if self.is_other: self.type = "Video" + if not self.is_music and self.update_blank_track_titles: + self.update_blank_track_titles = False + logger.error(f"update_blank_track_titles library operation only works with music libraries") + if self.tmdb_collections and self.is_show: self.tmdb_collections = None logger.error("Config Error: tmdb_collections only work with Movie Libraries.") diff --git a/plex_meta_manager.py b/plex_meta_manager.py index b7c49d62..0b6a9190 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -443,6 +443,7 @@ def library_operations(config, library): logger.debug(f"Radarr Remove by Tag: {library.radarr_remove_by_tag}") logger.debug(f"Sonarr Add All Existing: {library.sonarr_add_all_existing}") logger.debug(f"Sonarr Remove by Tag: {library.sonarr_remove_by_tag}") + logger.debug(f"Update Blank Track Titles: {library.update_blank_track_titles}") logger.debug(f"TMDb Collections: {library.tmdb_collections}") logger.debug(f"Genre Collections: {library.genre_collections}") logger.debug(f"Genre Mapper: {library.genre_mapper}") @@ -456,6 +457,11 @@ def library_operations(config, library): item.split() logger.info(util.adjust_space(f"{item.title[:25]:<25} | Splitting")) + if library.update_blank_track_titles: + for item in library.get_all(collection_level="track"): + if not item.title and item.sortTitle: + library.edit_query(item, {"title.locked": 1, "title.value": item.sortTitle}) + tmdb_collections = {} if library.items_library_operation: items = library.get_all(load=True)