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:
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,19 +87,24 @@ 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
"""
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)
if len(paths):
self.save_paths()
return 1