parent
871aeb8436
commit
d8fd952456
20
src/main.rs
20
src/main.rs
@ -40,7 +40,10 @@ struct LibOpt {
|
||||
#[structopt(long = "ssh", help = "Beets SSH URI")]
|
||||
beets_ssh_uri: Option<OsString>,
|
||||
|
||||
#[structopt(long = "beets", help = "Beets config file path")]
|
||||
#[structopt(long = "beets-bin", help = "Beets binary path")]
|
||||
beets_bin_path: Option<OsString>,
|
||||
|
||||
#[structopt(long = "beets-config", help = "Beets config file path")]
|
||||
beets_config_file_path: Option<OsString>,
|
||||
|
||||
#[structopt(long = "no-library", help = "Do not connect to the library")]
|
||||
@ -118,13 +121,22 @@ fn with_library(lib_opt: LibOpt, db_opt: DbOpt, builder: MusicHoardBuilder<NoDat
|
||||
.map(|s| s.into_string())
|
||||
.transpose()
|
||||
.expect("failed to extract beets config file path");
|
||||
let lib_exec = BeetsLibrarySshExecutor::new(uri)
|
||||
let lib_exec = match lib_opt.beets_bin_path {
|
||||
Some(beets_bin) => {
|
||||
let bin = beets_bin.into_string().expect("invalid beets binary path");
|
||||
BeetsLibrarySshExecutor::bin(uri, bin)
|
||||
}
|
||||
None => BeetsLibrarySshExecutor::new(uri),
|
||||
}
|
||||
.expect("failed to initialise beets")
|
||||
.config(beets_config_file_path);
|
||||
with_database(db_opt, builder.set_library(BeetsLibrary::new(lib_exec)));
|
||||
} else {
|
||||
let lib_exec =
|
||||
BeetsLibraryProcessExecutor::default().config(lib_opt.beets_config_file_path);
|
||||
let lib_exec = match lib_opt.beets_bin_path {
|
||||
Some(beets_bin) => BeetsLibraryProcessExecutor::bin(beets_bin),
|
||||
None => BeetsLibraryProcessExecutor::default(),
|
||||
}
|
||||
.config(lib_opt.beets_config_file_path);
|
||||
with_database(db_opt, builder.set_library(BeetsLibrary::new(lib_exec)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user