App architecture modifications.

Now GUI and the app itself is divided into two different binaries.
The app also provides system tray icon.
Whereas the GUI can be used to configure the app.
This commit is contained in:
Abraham
2023-06-11 19:17:50 +05:00
parent d4fcb0ea9c
commit 4f3d572b26
232 changed files with 5059 additions and 8081 deletions

1
.gitignore vendored
View File

@@ -13,6 +13,7 @@ dist-ssr
*.local
# Editor directories and files
.vscode
.vscode/*
!.vscode/extensions.json
.idea

View File

@@ -1,7 +0,0 @@
{
"recommendations": [
"svelte.svelte-vscode",
"tauri-apps.tauri-vscode",
"rust-lang.rust-analyzer"
]
}

File diff suppressed because it is too large Load Diff

35
app/Cargo.toml Normal file
View File

@@ -0,0 +1,35 @@
[package]
name = "jarvis-app"
version = "0.0.3"
description = "Jarvis Voice Assistant"
authors = ["Abraham Tugalov"]
license = "GPL-3.0-only"
repository = "https://github.com/Priler/jarvis"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1.0.164", features = ["derive"] }
serde_json = "1.0.96"
hound = "3.5.0"
pv_recorder = "1.1.2"
pv_porcupine = "2.2.1"
seqdiff = "0.3.0"
vosk = "0.2.0"
rand = "0.8.5"
rodio = "0.17.1"
rustpotter = "2.0.0"
log = "0.4.18"
once_cell = "1.18.0"
atomic_enum = "0.2.0"
portaudio = "0.7.0"
platform-dirs = "0.3.0"
simple-log = "1.6.0"
tray-icon = { version = "0.5.1" }
winit = "0.28.6"
image = "0.24.6"
serde_yaml = "0.9.21"
kira = "0.8.3"
[features]

45
app/Makefile.toml Normal file
View File

@@ -0,0 +1,45 @@
[tasks.format]
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--", "--emit=files"]
[tasks.clean]
command = "cargo"
args = ["clean"]
[tasks.build_debug]
command = "cargo"
args = ["build"]
[tasks.run]
command = "cargo"
args = ["run"]
[tasks.build_release]
command = "cargo"
args = ["build", "--release"]
dependencies = ["clean"]
[tasks.test]
command = "cargo"
args = ["test"]
# dependencies = ["clean"]
[tasks.post_build]
script_runner = "python"
script_extension = "py"
script = { file = "post_build.py" }
[tasks.debug]
dependencies = [
"format",
"build_debug",
"post_build"
]
[tasks.release]
dependencies = [
"format",
"build_release",
"post_build"
]

4
app/build.rs Normal file
View File

@@ -0,0 +1,4 @@
fn main() {
// link to Vosk lib
// println!("cargo:rustc-link-lib=libvosk.dll");
}

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

63
app/post_build.py Normal file
View File

@@ -0,0 +1,63 @@
# 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
SOURCE = (
"commands/",
"vosk/",
"lib/",
"keywords/",
"libgcc_s_seh-1.dll",
"libstdc++-6.dll",
"libvosk.dll",
"libvosk.lib",
"libwinpthread-1.dll"
)
TARGET_DIRS = (
"target/debug",
"target/release"
)
ABS_PATH = os.getcwd() + "/"
for tdir in TARGET_DIRS:
tdir = ABS_PATH + tdir
if not Path(tdir).is_dir():
print("Skipping target, not a directory: ", tdir)
continue
# copy lib files
for src in SOURCE:
if os.path.isdir(ABS_PATH + src):
# copy the whole directory
full_target_dir_path = os.path.join(tdir, src)
if os.path.isdir(full_target_dir_path):
print("[-] Directory already exists, skipping: ", src)
else:
shutil.copytree(ABS_PATH + src, os.path.join(tdir, src))
print("[+] Directory copied: ", src)
elif os.path.isfile(ABS_PATH + src):
# copy file
full_target_file_path = os.path.join(tdir, src)
if os.path.isfile(full_target_file_path):
print("[-] File already exists, skipping: ", src)
else:
shutil.copy(ABS_PATH + src, tdir)
print("[+] File copied: ", src)
else:
print("[?] Unknown entity to copy: ", src)
print("Post compile build done.")

Some files were not shown because too many files have changed in this diff Show More