Skip to content

Commit

Permalink
v0.16.0: release candidate v1
Browse files Browse the repository at this point in the history
  • Loading branch information
GiviMAD committed Jun 11, 2022
1 parent ada2232 commit a6df3af
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "rustpotter-cli"
version = "0.15.0"
version = "0.16.0"
edition = "2021"
license = "Apache-2.0"
description = "CLI for Rustpotter, an open source wake word spotter forged in rust"
authors = ["Miguel Álvarez Díez <[email protected]>"]
repository = "https://github.com/GiviMAD/rustpotter"

[dependencies]
rustpotter = { version = "0.15.0", features = ["log", "vad"] }
rustpotter = { version = "0.16.0", features = ["log", "vad"] }
log = "0.4.6"
pv_recorder = "1.0.2"
ctrlc = "3.2.2"
Expand Down
8 changes: 4 additions & 4 deletions src/cli/build_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ pub fn build(command: BuildModelCommand) -> Result<(), String> {
enable_rustpotter_log();
}
let mut word_detector = WakewordDetectorBuilder::new().build();
word_detector.add_wakeword(
word_detector.add_wakeword_with_wav_files(
&command.model_name,
false,
command.averaged_threshold,
command.threshold,
command.sample_path,
);
).map_err(|e| e.to_string())?;
match word_detector.generate_wakeword_model_file(command.model_name.clone(), command.model_path)
{
Ok(_) => {
println!("{} created!", command.model_name);
}
Err(message) => {
clap::Error::raw(clap::ErrorKind::InvalidValue, message + "\n").exit();
Err(error) => {
clap::Error::raw(clap::ErrorKind::InvalidValue, error.to_string() + "\n").exit();
}
};
Ok(())
Expand Down
7 changes: 2 additions & 5 deletions src/cli/spot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,10 @@ pub fn spot(command: SpotCommand) -> Result<(), String> {
.set_eager_mode(command.eager_mode)
.set_single_thread(command.single_thread)
.build();
let mut wakeword_names: Vec<String> = Vec::new();
for path in command.model_path {
let result = word_detector.add_wakeword_from_model_file(path, true);
if result.is_err() {
clap::Error::raw(clap::ErrorKind::InvalidValue, result.unwrap_err() + "\n").exit();
} else {
wakeword_names.push(result.unwrap());
if let Err(error) = result {
clap::Error::raw(clap::ErrorKind::InvalidValue, error.to_string() + "\n").exit();
}
}
let mut recorder_builder = RecorderBuilder::new();
Expand Down
5 changes: 2 additions & 3 deletions src/cli/test_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ pub fn test(command: TestModelCommand) -> Result<(), String> {
.set_sample_format(wav_specs.sample_format)
.set_channels(wav_specs.channels)
.build();
let add_wakeword_result = word_detector.add_wakeword_from_model_file(command.model_path, true);
if add_wakeword_result.is_err() {
if let Err(error) = word_detector.add_wakeword_from_model_file(command.model_path, true) {
clap::Error::raw(
clap::ErrorKind::InvalidValue,
add_wakeword_result.unwrap_err() + "\n",
error.to_string() + "\n",
)
.exit();
}
Expand Down

0 comments on commit a6df3af

Please sign in to comment.