@@ -122,6 +122,8 @@ values are:
|
||||
|
||||
* `use_nerdfont`: Turn nerdfont glyphs on/off <true/false>
|
||||
* `theme`: Set a custom color palette (see below)
|
||||
* `backend`: Audio backend to use, run `ncspot -h` for a list of devices
|
||||
* `backend_device`: Audio device string to configure the backend
|
||||
* `audio_cache`: Enable or disable caching of audio files, on by default
|
||||
<true/false>
|
||||
* `volnorm`: Enable or disable volume normalization, off by default <true/false>
|
||||
|
||||
@@ -14,6 +14,8 @@ pub struct Config {
|
||||
pub use_nerdfont: Option<bool>,
|
||||
pub saved_state: Option<SavedState>,
|
||||
pub audio_cache: Option<bool>,
|
||||
pub backend: Option<String>,
|
||||
pub backend_device: Option<String>,
|
||||
pub volnorm: Option<bool>,
|
||||
pub volnorm_pregain: Option<f32>,
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ use cursive::Cursive;
|
||||
|
||||
use librespot_core::authentication::Credentials;
|
||||
use librespot_core::cache::Cache;
|
||||
use librespot_playback::audio_backend;
|
||||
|
||||
mod album;
|
||||
mod artist;
|
||||
@@ -121,10 +122,15 @@ fn credentials_prompt(reset: bool) -> Credentials {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let backends = {
|
||||
let backends: Vec<&str> = audio_backend::BACKENDS.iter().map(|b| b.0).collect();
|
||||
format!("Audio backends: {}", backends.join(", "))
|
||||
};
|
||||
let matches = App::new("ncspot")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author("Henrik Friedrichsen <henrik@affekt.org> and contributors")
|
||||
.about("cross-platform ncurses Spotify client")
|
||||
.after_help(&*backends)
|
||||
.arg(
|
||||
Arg::with_name("debug")
|
||||
.short("d")
|
||||
|
||||
@@ -373,12 +373,12 @@ impl Spotify {
|
||||
let mixer = create_mixer(None);
|
||||
mixer.set_volume(volume);
|
||||
|
||||
let backend = audio_backend::find(None).unwrap();
|
||||
let backend = audio_backend::find(cfg.backend.clone()).unwrap();
|
||||
let (player, _eventchannel) = Player::new(
|
||||
player_config,
|
||||
session.clone(),
|
||||
mixer.get_audio_filter(),
|
||||
move || (backend)(None),
|
||||
move || (backend)(cfg.backend_device),
|
||||
);
|
||||
|
||||
let worker = Worker::new(events, commands, session, player, mixer);
|
||||
|
||||
Reference in New Issue
Block a user