Merge pull request #173 from MartinMF/fix/windows-tts-stt
Fix for Windows setup --server --local: TTS and STT
This commit is contained in:
commit
2d3c3fd4a0
|
@ -43,7 +43,9 @@ def install(service_dir):
|
||||||
# Check if whisper-rust executable exists before attempting to build
|
# 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")):
|
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
|
# Check if Rust is installed. Needed to build whisper executable
|
||||||
rustc_path = shutil.which('rustc')
|
|
||||||
|
rustc_path = shutil.which("rustc")
|
||||||
|
|
||||||
if rustc_path is None:
|
if rustc_path is None:
|
||||||
print("Rust is not installed or is not in system PATH. Please install Rust before proceeding.")
|
print("Rust is not installed or is not in system PATH. Please install Rust before proceeding.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Tts:
|
||||||
return
|
return
|
||||||
elif OS == "Windows":
|
elif OS == "Windows":
|
||||||
if ARCH == "AMD64":
|
if ARCH == "AMD64":
|
||||||
ARCH = "x64"
|
ARCH = "amd64"
|
||||||
else:
|
else:
|
||||||
print("Piper: unsupported architecture")
|
print("Piper: unsupported architecture")
|
||||||
return
|
return
|
||||||
|
@ -57,14 +57,15 @@ class Tts:
|
||||||
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/"
|
||||||
|
|
||||||
if OS == "windows":
|
asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}"
|
||||||
asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}".replace(".tar.gz", ".zip")
|
if OS == "Windows":
|
||||||
|
asset_url = asset_url.replace(".tar.gz", ".zip")
|
||||||
|
|
||||||
# Download and extract Piper
|
# Download and extract Piper
|
||||||
urllib.request.urlretrieve(asset_url, os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME))
|
urllib.request.urlretrieve(asset_url, os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME))
|
||||||
|
|
||||||
# Extract the downloaded file
|
# Extract the downloaded file
|
||||||
if OS == "windows":
|
if OS == "Windows":
|
||||||
import zipfile
|
import zipfile
|
||||||
with zipfile.ZipFile(os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME), 'r') as zip_ref:
|
with zipfile.ZipFile(os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME), 'r') as zip_ref:
|
||||||
zip_ref.extractall(path=PIPER_FOLDER_PATH)
|
zip_ref.extractall(path=PIPER_FOLDER_PATH)
|
||||||
|
@ -105,4 +106,4 @@ class Tts:
|
||||||
|
|
||||||
print("Piper setup completed.")
|
print("Piper setup completed.")
|
||||||
else:
|
else:
|
||||||
print("Piper already set up. Skipping download.")
|
print("Piper already set up. Skipping download.")
|
|
@ -45,16 +45,20 @@ last_messages = ""
|
||||||
|
|
||||||
def check_filtered_kernel():
|
def check_filtered_kernel():
|
||||||
messages = get_kernel_messages()
|
messages = get_kernel_messages()
|
||||||
if messages:
|
if messages is None:
|
||||||
messages.replace(last_messages, "")
|
return "" # Handle unsupported platform or error in fetching kernel messages
|
||||||
messages = messages.split("\n")
|
|
||||||
|
global last_messages
|
||||||
filtered_messages = []
|
messages.replace(last_messages, "")
|
||||||
for message in messages:
|
messages = messages.split("\n")
|
||||||
if custom_filter(message):
|
|
||||||
filtered_messages.append(message)
|
filtered_messages = []
|
||||||
|
for message in messages:
|
||||||
return "\n".join(filtered_messages)
|
if custom_filter(message):
|
||||||
|
filtered_messages.append(message)
|
||||||
|
|
||||||
|
return "\n".join(filtered_messages)
|
||||||
|
|
||||||
|
|
||||||
async def put_kernel_messages_into_queue(queue):
|
async def put_kernel_messages_into_queue(queue):
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in New Issue