Fehler in der class_file_path.py beseitigt

This commit is contained in:
Eduard Wisch 2025-05-19 14:00:15 +02:00
parent 7147f6385e
commit 545996d501

View file

@ -59,10 +59,10 @@ class Path:
try: try:
with open(f"app/cfg/{self.yaml['path_file']}", "r", encoding="utf8") as file: with open(f"app/cfg/{self.yaml['path_file']}", "r", encoding="utf8") as file:
list_paths = yaml.safe_load(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: if count > 0:
paths = list_paths self.receive_paths(list_paths)
logging.info(f"{count} paths were read from file") logging.info(f"{count} paths were read from file")
return 1 return 1
@ -87,20 +87,25 @@ class Path:
except ValueError: except ValueError:
return 0 return 0
def receive_paths(self, var_paths:str): def receive_paths(self, var_paths):
""" """
Splitting the Path String to List Single Media 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 :return: True or False
""" """
pattern = r"(?<=\.mkv\s|\.mp4\s|\.avi\s)|(?<=\.webm\s)" if isinstance(var_paths, str):
paths = re.split(pattern, var_paths) pattern = r"(?<=\.mkv\s|\.mp4\s|\.avi\s)|(?<=\.webm\s)"
paths = re.split(pattern, var_paths)
else:
paths = var_paths
for path in paths: for path in paths:
self.get_with_ffprobe(path) self.get_with_ffprobe(path)
print(paths) print(paths)
self.save_paths()
if len(paths):
self.save_paths()
return 1 return 1