fix for #165
Bug: Piper TTS Service Fails on Windows due to Non-Cross Platform Code
This commit is contained in:
parent
4be9861fb7
commit
33a0c14d67
|
@ -4,6 +4,8 @@ import os
|
|||
import subprocess
|
||||
import urllib.request
|
||||
import tarfile
|
||||
import platform
|
||||
|
||||
|
||||
class Tts:
|
||||
def __init__(self, config):
|
||||
|
@ -30,12 +32,12 @@ class Tts:
|
|||
def install(self, service_directory):
|
||||
PIPER_FOLDER_PATH = service_directory
|
||||
self.piper_directory = os.path.join(PIPER_FOLDER_PATH, 'piper')
|
||||
if not os.path.isdir(self.piper_directory): # Check if the Piper directory exists
|
||||
if not os.path.isdir(self.piper_directory): # Check if the Piper directory exists
|
||||
os.makedirs(PIPER_FOLDER_PATH, exist_ok=True)
|
||||
|
||||
# Determine OS and architecture
|
||||
OS = os.uname().sysname
|
||||
ARCH = os.uname().machine
|
||||
OS = platform.system()
|
||||
ARCH = platform.machine()
|
||||
if OS == "Darwin":
|
||||
OS = "macos"
|
||||
if ARCH == "arm64":
|
||||
|
@ -45,6 +47,12 @@ class Tts:
|
|||
else:
|
||||
print("Piper: unsupported architecture")
|
||||
return
|
||||
elif OS == "Windows":
|
||||
if ARCH == "AMD64":
|
||||
ARCH = "x64"
|
||||
else:
|
||||
print("Piper: unsupported architecture")
|
||||
return
|
||||
|
||||
PIPER_ASSETNAME = f"piper_{OS}_{ARCH}.tar.gz"
|
||||
PIPER_URL = "https://github.com/rhasspy/piper/releases/latest/download/"
|
||||
|
|
Loading…
Reference in New Issue