diff --git a/modules/builder.py b/modules/builder.py index 028d95d5..c2499477 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1601,23 +1601,6 @@ class CollectionBuilder: self.library.collection_order_query(self.obj, self.details["collection_order"]) logger.info(f"Detail: collection_order updated Collection Order to {self.details['collection_order']}") - if "label" in self.details or "label.remove" in self.details or "label.sync" in self.details: - item_labels = [label.tag for label in self.obj.labels] - if "label" in self.details or "label.sync" in self.details: - labels = self.details["label" if "label" in self.details else "label.sync"] - if "label.sync" in self.details: - for label in (la for la in item_labels if la not in labels): - self.library.query_data(self.obj.removeLabel, label) - logger.info(f"Detail: Label {label} removed") - for label in (la for la in labels if la not in item_labels): - self.library.query_data(self.obj.addLabel, label) - logger.info(f"Detail: Label {label} added") - if "label.remove" in self.details: - for label in self.details["label.remove"]: - if label in item_labels: - self.library.query_data(self.obj.removeLabel, label) - logger.info(f"Detail: Label {label} removed") - add_tags = self.details["label"] if "label" in self.details else None remove_tags = self.details["label.remove"] if "label.remove" in self.details else None sync_tags = self.details["label.sync"] if "label.sync" in self.details else None diff --git a/modules/plex.py b/modules/plex.py index 6f39f423..ac8e55fd 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -324,7 +324,9 @@ class PlexAPI: self.Sonarr = None self.Tautulli = None self.name = params["name"] - self.mapping_name = util.validate_filename(params["mapping_name"]) + self.mapping_name, output = util.validate_filename(params["mapping_name"]) + if output: + logger.info(output) self.missing_path = os.path.join(params["default_dir"], f"{self.name}_missing.yml") self.metadata_path = params["metadata_path"] self.asset_directory = params["asset_directory"] diff --git a/modules/util.py b/modules/util.py index 993b444b..df95f7d0 100644 --- a/modules/util.py +++ b/modules/util.py @@ -393,8 +393,7 @@ def print_end(length, text=None): def validate_filename(filename): if is_valid_filename(filename): - return filename + return filename, None else: mapping_name = sanitize_filename(filename) - logger.info(f"Folder Name: {filename} is invalid using {mapping_name}") - return mapping_name + return mapping_name, f"Log Folder Name: {filename} is invalid using {mapping_name}" diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 6cf0be6d..2d4300bf 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -115,7 +115,7 @@ def start(config_path, is_test, daily, requested_collections, requested_librarie logger.critical(e) logger.info("") util.separator(f"Finished {start_type}Run\nRun Time: {str(datetime.now() - start_time).split('.')[0]}") - logger.addHandler(file_handler) + logger.removeHandler(file_handler) def update_libraries(config, is_test, requested_collections, resume_from): for library in config.libraries: @@ -372,10 +372,10 @@ def mass_metadata(config, library, movie_map, show_map): except Failed as e: logger.error(e) - def run_collection(config, library, metadata, requested_collections, is_test, resume_from, movie_map, show_map): logger.info("") for mapping_name, collection_attrs in requested_collections.items(): + collection_start = datetime.now() if is_test and ("test" not in collection_attrs or collection_attrs["test"] is not True): no_template_test = True if "template" in collection_attrs and collection_attrs["template"]: @@ -399,9 +399,9 @@ def run_collection(config, library, metadata, requested_collections, is_test, re util.separator(f"Resuming Collections") if "name_mapping" in collection_attrs and collection_attrs["name_mapping"]: - collection_log_name = util.validate_filename(collection_attrs["name_mapping"]) + collection_log_name, output_str = util.validate_filename(collection_attrs["name_mapping"]) else: - collection_log_name = util.validate_filename(mapping_name) + collection_log_name, output_str = util.validate_filename(mapping_name) collection_log_folder = os.path.join(default_dir, "logs", library.mapping_name, "collections", collection_log_name) os.makedirs(collection_log_folder, exist_ok=True) col_file_logger = os.path.join(collection_log_folder, f"collection.log") @@ -415,6 +415,9 @@ def run_collection(config, library, metadata, requested_collections, is_test, re try: util.separator(f"{mapping_name} Collection") logger.info("") + if output_str: + logger.info(output_str) + logger.info("") builder = CollectionBuilder(config, library, metadata, mapping_name, collection_attrs) @@ -453,6 +456,7 @@ def run_collection(config, library, metadata, requested_collections, is_test, re util.print_stacktrace() logger.error(f"Unknown Error: {e}") logger.info("") + util.separator(f"Finished {mapping_name} Collection\nCollection Run Time: {str(datetime.now() - collection_start).split('.')[0]}") logger.removeHandler(collection_handler) return resume_from