vosk model selection in GUI

This commit is contained in:
Priler 2026-01-05 03:38:04 +05:00
parent 36acacf259
commit cab53abcbe
14 changed files with 323 additions and 40 deletions

View file

@ -1,27 +1,26 @@
# Simple python script used to
# copy some libraries to the "target" directory
# after Rust build
# Note that Rust build should be run via "cargo make <cmd>" command
# in order to automate all the compile process
import os
from pathlib import Path
import shutil
# some config vars
# format: (source, destination_name)
SOURCE = (
"resources/commands/",
"resources/vosk/",
"resources/lib/",
"resources/keywords/",
"resources/rustpotter/",
"resources/sound/",
"lib/windows/amd64/libgcc_s_seh-1.dll",
"lib/windows/amd64/libstdc++-6.dll",
"lib/windows/amd64/libvosk.dll",
"lib/windows/amd64/libvosk.lib",
"lib/windows/amd64/libwinpthread-1.dll"
("resources/commands/", "resources/commands/"),
("resources/vosk/", "resources/vosk/"),
("resources/lib/", "lib/"),
("resources/keywords/", "resources/keywords/"),
("resources/rustpotter/", "resources/rustpotter/"),
("resources/sound/", "resources/sound/"),
("lib/windows/amd64/libgcc_s_seh-1.dll", None),
("lib/windows/amd64/libstdc++-6.dll", None),
("lib/windows/amd64/libvosk.dll", None),
("lib/windows/amd64/libvosk.lib", None),
("lib/windows/amd64/libwinpthread-1.dll", None)
)
TARGET_DIRS = (
@ -39,27 +38,36 @@ for tdir in TARGET_DIRS:
continue
# copy lib files
for src in SOURCE:
if os.path.isdir(ABS_PATH + src):
for entry in SOURCE:
if isinstance(entry, tuple):
src, dest_name = entry
else:
src, dest_name = entry, None
src_path = ABS_PATH + src
if os.path.isdir(src_path):
# copy the whole directory
full_target_dir_path = os.path.join(tdir, src)
target_name = dest_name if dest_name else os.path.basename(src.rstrip('/'))
full_target_dir_path = os.path.join(tdir, target_name)
if os.path.isdir(full_target_dir_path):
print("[-] Directory already exists, skipping: ", src)
print("[-] Directory already exists, skipping: ", src, "->", target_name)
else:
shutil.copytree(ABS_PATH + src, os.path.join(tdir, src))
shutil.copytree(src_path, full_target_dir_path)
print("[+] Directory copied: ", src, "->", target_name)
print("[+] Directory copied: ", src)
elif os.path.isfile(ABS_PATH + src):
elif os.path.isfile(src_path):
# copy file
full_target_file_path = os.path.join(tdir, src)
target_name = dest_name if dest_name else os.path.basename(src)
full_target_file_path = os.path.join(tdir, target_name)
if os.path.isfile(full_target_file_path):
print("[-] File already exists, skipping: ", src)
print("[-] File already exists, skipping: ", src, "->", target_name)
else:
shutil.copy(ABS_PATH + src, tdir)
print("[+] File copied: ", src)
shutil.copy(src_path, full_target_file_path)
print("[+] File copied: ", src, "->", target_name)
else:
print("[?] Unknown entity to copy: ", src)
print("Post compile build done.")