From aca34eeeceb0f406749e162b52b3ac7c7dc19b03 Mon Sep 17 00:00:00 2001 From: Martin Moehle Date: Wed, 27 Mar 2024 18:28:10 +0100 Subject: [PATCH 1/2] Adjusted piper download link for windows --- software/source/server/services/tts/piper/tts.py | 11 ++++++----- software/source/server/utils/kernel.py | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/software/source/server/services/tts/piper/tts.py b/software/source/server/services/tts/piper/tts.py index a7f91c77..c7e65b0d 100644 --- a/software/source/server/services/tts/piper/tts.py +++ b/software/source/server/services/tts/piper/tts.py @@ -49,7 +49,7 @@ def install(self, service_directory): return elif OS == "Windows": if ARCH == "AMD64": - ARCH = "x64" + ARCH = "amd64" else: print("Piper: unsupported architecture") return @@ -57,14 +57,15 @@ def install(self, service_directory): PIPER_ASSETNAME = f"piper_{OS}_{ARCH}.tar.gz" PIPER_URL = "https://github.com/rhasspy/piper/releases/latest/download/" - if OS == "windows": - asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}".replace(".tar.gz", ".zip") + asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}" + if OS == "Windows": + 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)) # Extract the downloaded file - if OS == "windows": + if OS == "Windows": import zipfile with zipfile.ZipFile(os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME), 'r') as zip_ref: zip_ref.extractall(path=PIPER_FOLDER_PATH) @@ -105,4 +106,4 @@ def install(self, service_directory): print("Piper setup completed.") else: - print("Piper already set up. Skipping download.") + print("Piper already set up. Skipping download.") \ No newline at end of file diff --git a/software/source/server/utils/kernel.py b/software/source/server/utils/kernel.py index b443bbaf..5d2f0935 100644 --- a/software/source/server/utils/kernel.py +++ b/software/source/server/utils/kernel.py @@ -45,6 +45,10 @@ def custom_filter(message): def check_filtered_kernel(): messages = get_kernel_messages() + if messages is None: + return "" # Handle unsupported platform or error in fetching kernel messages + + global last_messages messages.replace(last_messages, "") messages = messages.split("\n") From 547c4afb57828f8c36c97b6591c277a167f6ad46 Mon Sep 17 00:00:00 2001 From: Martin Moehle Date: Wed, 27 Mar 2024 18:28:59 +0100 Subject: [PATCH 2/2] Adjusted rust installation check to work with windows --- software/source/server/services/stt/local-whisper/stt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/software/source/server/services/stt/local-whisper/stt.py b/software/source/server/services/stt/local-whisper/stt.py index b318e8e8..4ceaf105 100644 --- a/software/source/server/services/stt/local-whisper/stt.py +++ b/software/source/server/services/stt/local-whisper/stt.py @@ -42,8 +42,8 @@ def install(service_dir): # Check if whisper-rust executable exists before attempting to build if not os.path.isfile(os.path.join(WHISPER_RUST_PATH, "target/release/whisper-rust")): # Check if Rust is installed. Needed to build whisper executable - rust_check = subprocess.call('command -v rustc', shell=True) - if rust_check != 0: + rustc_path = shutil.which("rustc") + if rustc_path is None: print("Rust is not installed or is not in system PATH. Please install Rust before proceeding.") exit(1)