From 545996d5017e85c26d73ba8a694c8ae4275d5f19 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 19 May 2025 14:00:15 +0200 Subject: [PATCH] Fehler in der class_file_path.py beseitigt --- app/class_file_path.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/class_file_path.py b/app/class_file_path.py index 0e990b9..babd6dd 100755 --- a/app/class_file_path.py +++ b/app/class_file_path.py @@ -59,10 +59,10 @@ class Path: try: with open(f"app/cfg/{self.yaml['path_file']}", "r", encoding="utf8") as file: list_paths = yaml.safe_load(file) - count = sum(1 for v in list_paths.values() if v) + count = len(list_paths.get("paths", [])) if count > 0: - paths = list_paths + self.receive_paths(list_paths) logging.info(f"{count} paths were read from file") return 1 @@ -87,20 +87,25 @@ class Path: except ValueError: return 0 - def receive_paths(self, var_paths:str): + def receive_paths(self, var_paths): """ Splitting the Path String to List Single Media Paths - :param var_paths: String of a single or more Media Paths + :param var_paths: String or List of a single or more Media Paths :return: True or False """ - pattern = r"(?<=\.mkv\s|\.mp4\s|\.avi\s)|(?<=\.webm\s)" - paths = re.split(pattern, var_paths) + if isinstance(var_paths, str): + pattern = r"(?<=\.mkv\s|\.mp4\s|\.avi\s)|(?<=\.webm\s)" + paths = re.split(pattern, var_paths) + else: + paths = var_paths for path in paths: self.get_with_ffprobe(path) print(paths) - self.save_paths() + + if len(paths): + self.save_paths() return 1