diff --git a/server.py b/server.py index dbdc257..14ce3b2 100644 --- a/server.py +++ b/server.py @@ -33,16 +33,17 @@ class SignData: expiration: datetime.datetime def to_subprocess_command(self) -> str: + # use lstrip('#') instead of [1:] in order to handle cases where the color might not start with '#' return [ os.path.join(WORKING_DIRECTORY, "sce_sign.exe"), "--set-speed", str(self.scrollSpeed) + " px/vsync", "--set-background-color", - self.backgroundColor[1:], + self.backgroundColor.lstrip('#'), "--set-font-color", - self.textColor[1:], + self.textColor.lstrip('#'), "--set-border-color", - self.borderColor[1:], + self.borderColor.lstrip('#'), "--set-font-filename", os.path.join(WORKING_DIRECTORY, "10x20.bdf"), "--set-brightness", @@ -153,10 +154,13 @@ def write_message_to_sign(new_data): "starting sign process with command " + " \\\n\t".join(new_data.to_subprocess_command()) ) - process = subprocess.Popen( - args=new_data.to_subprocess_command(), - ) - logging.info(f"sign process started with pid {process.pid}") + try: + process = subprocess.Popen( + args=new_data.to_subprocess_command(), + ) + logging.info(f"sign process started with pid {process.pid}") + except Exception as e: + logging.exception("Failed to start sign process") sign_data = new_data diff --git a/static/index.html b/static/index.html index 3337e15..d6301b1 100644 --- a/static/index.html +++ b/static/index.html @@ -7,22 +7,26 @@
-