diff --git a/src/main.rs b/src/main.rs index d9edcae..3f60c88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,10 @@ struct LibOpt { #[structopt(long = "ssh", help = "Beets SSH URI")] beets_ssh_uri: Option, - #[structopt(long = "beets", help = "Beets config file path")] + #[structopt(long = "beets-bin", help = "Beets binary path")] + beets_bin_path: Option, + + #[structopt(long = "beets-config", help = "Beets config file path")] beets_config_file_path: Option, #[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 { + 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))); } }