|
|
@ -4,6 +4,8 @@ import os
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
import urllib.request
|
|
|
|
import urllib.request
|
|
|
|
import tarfile
|
|
|
|
import tarfile
|
|
|
|
|
|
|
|
import platform
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Tts:
|
|
|
|
class Tts:
|
|
|
|
def __init__(self, config):
|
|
|
|
def __init__(self, config):
|
|
|
@ -30,12 +32,12 @@ class Tts:
|
|
|
|
def install(self, service_directory):
|
|
|
|
def install(self, service_directory):
|
|
|
|
PIPER_FOLDER_PATH = service_directory
|
|
|
|
PIPER_FOLDER_PATH = service_directory
|
|
|
|
self.piper_directory = os.path.join(PIPER_FOLDER_PATH, 'piper')
|
|
|
|
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)
|
|
|
|
os.makedirs(PIPER_FOLDER_PATH, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
# Determine OS and architecture
|
|
|
|
# Determine OS and architecture
|
|
|
|
OS = os.uname().sysname
|
|
|
|
OS = platform.system()
|
|
|
|
ARCH = os.uname().machine
|
|
|
|
ARCH = platform.machine()
|
|
|
|
if OS == "Darwin":
|
|
|
|
if OS == "Darwin":
|
|
|
|
OS = "macos"
|
|
|
|
OS = "macos"
|
|
|
|
if ARCH == "arm64":
|
|
|
|
if ARCH == "arm64":
|
|
|
@ -45,6 +47,12 @@ class Tts:
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print("Piper: unsupported architecture")
|
|
|
|
print("Piper: unsupported architecture")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
elif OS == "Windows":
|
|
|
|
|
|
|
|
if ARCH == "AMD64":
|
|
|
|
|
|
|
|
ARCH = "x64"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("Piper: unsupported architecture")
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
PIPER_ASSETNAME = f"piper_{OS}_{ARCH}.tar.gz"
|
|
|
|
PIPER_ASSETNAME = f"piper_{OS}_{ARCH}.tar.gz"
|
|
|
|
PIPER_URL = "https://github.com/rhasspy/piper/releases/latest/download/"
|
|
|
|
PIPER_URL = "https://github.com/rhasspy/piper/releases/latest/download/"
|
|
|
|