From b059cbc0e497bad2f474e33d26409d74a9857541 Mon Sep 17 00:00:00 2001 From: Davy Peter Braun <543614+dheavy@users.noreply.github.com> Date: Thu, 28 Mar 2024 14:35:06 +0100 Subject: [PATCH 1/2] Fix UnboundLocalError for asset_url on Piper install (macOS) --- software/source/server/services/tts/piper/tts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/software/source/server/services/tts/piper/tts.py b/software/source/server/services/tts/piper/tts.py index a7f91c77..2060847c 100644 --- a/software/source/server/services/tts/piper/tts.py +++ b/software/source/server/services/tts/piper/tts.py @@ -57,8 +57,10 @@ def install(self, service_directory): PIPER_ASSETNAME = f"piper_{OS}_{ARCH}.tar.gz" PIPER_URL = "https://github.com/rhasspy/piper/releases/latest/download/" + asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}" + if OS == "windows": - asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}".replace(".tar.gz", ".zip") + asset_url = asset_url.replace(".tar.gz", ".zip") # Download and extract Piper urllib.request.urlretrieve(asset_url, os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME)) From 13b001fe9bb52adaa8db9abc2931f2faa3964b03 Mon Sep 17 00:00:00 2001 From: Davy Peter Braun <543614+dheavy@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:56:21 +0100 Subject: [PATCH 2/2] Fix case issues for OS forking logic --- software/source/server/services/tts/piper/tts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/software/source/server/services/tts/piper/tts.py b/software/source/server/services/tts/piper/tts.py index 2060847c..2ef6c0c2 100644 --- a/software/source/server/services/tts/piper/tts.py +++ b/software/source/server/services/tts/piper/tts.py @@ -36,9 +36,9 @@ def install(self, service_directory): os.makedirs(PIPER_FOLDER_PATH, exist_ok=True) # Determine OS and architecture - OS = platform.system() + OS = platform.system().lower() ARCH = platform.machine() - if OS == "Darwin": + if OS == "darwin": OS = "macos" if ARCH == "arm64": ARCH = "aarch64" @@ -47,7 +47,7 @@ def install(self, service_directory): else: print("Piper: unsupported architecture") return - elif OS == "Windows": + elif OS == "windows": if ARCH == "AMD64": ARCH = "x64" else: