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:
|
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,19 +87,24 @@ 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
|
||||||
"""
|
"""
|
||||||
|
if isinstance(var_paths, str):
|
||||||
pattern = r"(?<=\.mkv\s|\.mp4\s|\.avi\s)|(?<=\.webm\s)"
|
pattern = r"(?<=\.mkv\s|\.mp4\s|\.avi\s)|(?<=\.webm\s)"
|
||||||
paths = re.split(pattern, var_paths)
|
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)
|
||||||
|
|
||||||
|
if len(paths):
|
||||||
self.save_paths()
|
self.save_paths()
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue