Fehler in der class_file_path.py beseitigt
This commit is contained in:
parent
7147f6385e
commit
545996d501
1 changed files with 12 additions and 7 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue