From 352d77db6ad19ce097ef1e2dab70165cf67c57b0 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Mon, 2 Aug 2021 18:06:48 +0200 Subject: [PATCH] added analyze function to wszst.szs --- source/wszst/szs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/wszst/szs.py b/source/wszst/szs.py index 8289cfb..08fec0f 100644 --- a/source/wszst/szs.py +++ b/source/wszst/szs.py @@ -12,6 +12,24 @@ def extract(file: str, dest_dir: str = None) -> None: creationflags=subprocess.CREATE_NO_WINDOW) +def analyze(file: str) -> dict: + """ + return dictionnary with information about the track + :param file: track file + :return: directory + """ + ana_track = subprocess.run(["./tools/szs/wszst", "ANALYZE", file], check=True, + creationflags=subprocess.CREATE_NO_WINDOW, stdout=subprocess.PIPE).stdout.decode() + + dict_track = {} + for line in ana_track.split("\n"): + if "=" in line: + key, value = line.split("=", maxsplit=1) + dict_track[key] = value.strip() + + return dict_track + + def sha1(file, autoadd_path: str = "./file/auto-add/") -> str: """ :param autoadd_path: directory where is autoadd directory