From ade73908e73623e575de54a285302768dc5db084 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 18 Apr 2023 14:37:08 -0400 Subject: [PATCH] [21] better reporting --- VERSION | 2 +- modules/config.py | 15 ++++++++------- modules/meta.py | 4 ++-- modules/util.py | 4 +++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 274ad9b6..d9548fa6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.0-develop20 +1.19.0-develop21 diff --git a/modules/config.py b/modules/config.py index 21549c6e..0c4b6d25 100644 --- a/modules/config.py +++ b/modules/config.py @@ -631,8 +631,8 @@ class ConfigFile: default_playlist_file = os.path.abspath(os.path.join(self.default_dir, "playlists.yml")) logger.warning(f"Config Warning: playlist_files attribute is blank using default: {default_playlist_file}") paths_to_check = [default_playlist_file] - files = util.load_files(paths_to_check, "playlist_files", schedule=(current_time, self.run_hour, self.ignore_schedules)) - if not files: + files, had_scheduled = util.load_files(paths_to_check, "playlist_files", schedule=(current_time, self.run_hour, self.ignore_schedules)) + if not files and not had_scheduled: raise Failed("Config Error: No Paths Found for playlist_files") for file_type, playlist_file, temp_vars, asset_directory in files: try: @@ -831,10 +831,11 @@ class ConfigFile: if lib and "metadata_path" in lib: if not lib["metadata_path"]: raise Failed("Config Error: metadata_path attribute is blank") - files = util.load_files(lib["metadata_path"], "metadata_path", schedule=(current_time, self.run_hour, self.ignore_schedules), lib_vars=lib_vars) - if not files: + files, had_scheduled = util.load_files(lib["metadata_path"], "metadata_path", schedule=(current_time, self.run_hour, self.ignore_schedules), lib_vars=lib_vars) + if files: + params["metadata_path"] = files + elif not had_scheduled: raise Failed("Config Error: No Paths Found for metadata_path") - params["metadata_path"] = files elif os.path.exists(os.path.join(default_dir, f"{library_name}.yml")): params["metadata_path"] = [("File", os.path.join(default_dir, f"{library_name}.yml"), lib_vars, None)] except Failed as e: @@ -860,7 +861,7 @@ class ConfigFile: try: if not lib["overlay_path"]: raise Failed("Config Error: overlay_path attribute is blank") - files = util.load_files(lib["overlay_path"], "overlay_path", lib_vars=lib_vars) + files, _ = util.load_files(lib["overlay_path"], "overlay_path", lib_vars=lib_vars) for file in util.get_list(lib["overlay_path"], split=False): if isinstance(file, dict): if ("remove_overlays" in file and file["remove_overlays"] is True) \ @@ -920,7 +921,7 @@ class ConfigFile: if lib and "image_sets" in lib: if not lib["image_sets"]: raise Failed("Config Error: image_sets attribute is blank") - files = util.load_files(lib["image_sets"], "image_sets") + files, _ = util.load_files(lib["image_sets"], "image_sets") if not files: raise Failed("Config Error: No Paths Found for image_sets") params["image_sets"] = files diff --git a/modules/meta.py b/modules/meta.py index c9346c1e..3caa682a 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -567,7 +567,7 @@ class DataFile: def external_templates(self, data, overlay=False): if data and "external_templates" in data and data["external_templates"]: - files = util.load_files(data["external_templates"], "external_templates") + files, _ = util.load_files(data["external_templates"], "external_templates") if not files: logger.error("Config Error: No Paths Found for external_templates") for file_type, template_file, temp_vars, _ in files: @@ -1320,7 +1320,7 @@ class MetadataFile(DataFile): for alt in alts: self.library.collection_images[alt] = collection_data else: - files = util.load_files(style_file, "style_file", err_type=self.type_str, single=True) + files, _ = util.load_files(style_file, "style_file", err_type=self.type_str, single=True) if not files: raise Failed(f"{self.type_str} Error: No Path Found for style_file") file_type, style_path, _, _ = files[0] diff --git a/modules/util.py b/modules/util.py index 82fca6f2..42a28997 100644 --- a/modules/util.py +++ b/modules/util.py @@ -409,6 +409,7 @@ def time_window(tw): def load_files(files_to_load, method, err_type="Config", schedule=None, lib_vars=None, single=False): files = [] + had_scheduled = False if not lib_vars: lib_vars = {} files_to_load = get_list(files_to_load, split=False) @@ -471,6 +472,7 @@ def load_files(files_to_load, method, err_type="Config", schedule=None, lib_vars if not ignore_schedules: err = e if err: + had_scheduled = True logger.info(f"Metadata Schedule:{err}\n") for file_type, file_path, temp_vars, asset_directory in current: logger.warning(f"{file_type}: {file_path} not scheduled to run") @@ -482,7 +484,7 @@ def load_files(files_to_load, method, err_type="Config", schedule=None, lib_vars files.append(("File", file, {}, None)) else: logger.error(f"{err_type} Error: Path not found: {file}") - return files + return files, had_scheduled def check_num(num, is_int=True): try: