mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Tidied up Syntax
This commit is contained in:
parent
618eceb740
commit
fddcbbcd82
1 changed files with 12 additions and 11 deletions
21
src/main.rs
21
src/main.rs
|
@ -133,18 +133,19 @@ fn setup(args: &[String]) -> Setup {
|
||||||
let mixer = mixer::find(mixer_name.as_ref())
|
let mixer = mixer::find(mixer_name.as_ref())
|
||||||
.expect("Invalid mixer");
|
.expect("Invalid mixer");
|
||||||
|
|
||||||
let initial_volume;
|
let initial_volume: i32;
|
||||||
if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::<i32>().is_ok() {
|
if matches.opt_present("initial-volume") && matches.opt_str("initial-volume").unwrap().parse::<i32>().is_ok() {
|
||||||
let iv = matches.opt_str("initial-volume").unwrap().parse::<i32>().unwrap();
|
let iv = matches.opt_str("initial-volume").unwrap().parse::<i32>().unwrap();
|
||||||
if 0 <= iv && iv <= 100 {
|
match iv {
|
||||||
initial_volume = iv * 0xFFFF as i32 / 100 ;
|
iv if iv >= 0 && iv <= 100 => { initial_volume = iv * 0xFFFF / 100 }
|
||||||
} else {
|
_ => {
|
||||||
debug!("Volume needs to be a value from 0-100; set as 50%");
|
debug!("Volume needs to be a value from 0-100; set volume level to 50%");
|
||||||
initial_volume = 0x8000 as i32;
|
initial_volume = 0x8000;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
initial_volume = 0x8000 as i32;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
initial_volume = 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
let name = matches.opt_str("name").unwrap();
|
let name = matches.opt_str("name").unwrap();
|
||||||
let use_audio_cache = !matches.opt_present("disable-audio-cache");
|
let use_audio_cache = !matches.opt_present("disable-audio-cache");
|
||||||
|
|
Loading…
Reference in a new issue