From 2f7c2ef4ad9d0d15f1efbcc61cfb237a55eb531c Mon Sep 17 00:00:00 2001 From: Reggie Torres Date: Sat, 9 Mar 2024 22:52:39 -0500 Subject: [PATCH] fix samedec check (again) (very dumb fix someone make it better soon) (#39) * Add Contribution Tutorial * Fix Samedec Check (very dumb fix someone edit it later) * fix the fatal mistake called a string is always true * gitignore update * make it less dumb --- .gitignore | 7 +++++++ asmara.py | 25 ++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b615254 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +qrcodes/ +__pycache__ +secret_key.txt +ssl_cert.pem +ssl_key.key +.log +.config \ No newline at end of file diff --git a/asmara.py b/asmara.py index f5d8f8b..beba5e0 100644 --- a/asmara.py +++ b/asmara.py @@ -243,21 +243,8 @@ def __decoder__(self): sev=severity.trace, ) try: - if not ( - "samedec 0.1." - in Popen(["samedec", "-V"], stdout=PIPE) - .communicate()[0] - .decode("UTF-8") - .strip() - ): - utilities.autoPrint( - text=f"SAMEDEC is not version 0.2 or higher! Recommended version is 0.2.3.", - classType="DECODER", - sev=severity.fatal, - ) - AS_MAN.killAsmara() - exit(1) - else: + samedec_version = Popen(["samedec", "-V"], stdout=PIPE).communicate()[0].decode("UTF-8").strip() + if not samedec_version.startswith("samedec 0.1."): self.__decode__ = Popen( ["samedec", "-r", "24000"], stdout=PIPE, @@ -265,6 +252,14 @@ def __decoder__(self): stderr=PIPE, bufsize=1, ) + else: + utilities.autoPrint( + text=f"SAMEDEC is not version 0.2 or higher! Recommended version is 0.2.3.", + classType="DECODER", + sev=severity.fatal, + ) + AS_MAN.killAsmara() + exit(1) except FileNotFoundError: utilities.autoPrint( text=f"Samedec is not installed on the computer. Please install SAMEDEC 0.2.3 or higher.",