Skip to content

Commit

Permalink
Better naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonTeixidor committed Apr 23, 2017
1 parent 7d3a2de commit a238bd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct SpotifydConfig {
pub password: Option<String>,
pub cache: Option<Cache>,
pub backend: Option<String>,
pub device: Option<String>,
pub audio_device: Option<String>,
pub session_config: SessionConfig,
}

Expand All @@ -31,7 +31,7 @@ impl Default for SpotifydConfig {
password: None,
cache: None,
backend: None,
device: None,
audio_device: None,
session_config: SessionConfig {
bitrate: Bitrate::Bitrate160,
user_agent: version::version_string(),
Expand Down Expand Up @@ -104,7 +104,7 @@ pub fn get_config<P: AsRef<Path>>(config_path: Option<P>, matches: &Matches) ->
config.username = lookup("username");
config.password = lookup("password");
config.backend = lookup("backend");
config.device = lookup("device");
config.audio_device = lookup("device");
config.session_config.onstart = lookup("onstart");
config.session_config.onstop = lookup("onstop");
update(&mut config.session_config.bitrate,
Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct MainLoopState {
connection: Box<Future<Item = Session, Error = io::Error>>,
mixer: fn() -> Box<mixer::Mixer>,
backend: fn(Option<String>) -> Box<Sink>,
device_name: Option<String>,
audio_device: Option<String>,
spirc_task: Option<SpircTask>,
spirc: Option<Spirc>,
ctrl_c_stream: IoStream<()>,
Expand All @@ -57,7 +57,7 @@ impl MainLoopState {
fn new(connection: Box<Future<Item = Session, Error = io::Error>>,
mixer: fn() -> Box<mixer::Mixer>,
backend: fn(Option<String>) -> Box<Sink>,
device_name: Option<String>,
audio_device: Option<String>,
ctrl_c_stream: IoStream<()>,
discovery_stream: DiscoveryStream,
cache: Option<Cache>,
Expand All @@ -68,7 +68,7 @@ impl MainLoopState {
connection: connection,
mixer: mixer,
backend: backend,
device_name: device_name,
audio_device: audio_device,
spirc_task: None,
spirc: None,
ctrl_c_stream: ctrl_c_stream,
Expand Down Expand Up @@ -102,10 +102,10 @@ impl Future for MainLoopState {
let audio_filter = (self.mixer)().get_audio_filter();
self.connection = Box::new(futures::future::empty());
let backend = self.backend;
let device_name = self.device_name.clone();
let audio_device = self.audio_device.clone();
let player = Player::new(session.clone(),
audio_filter,
move || (backend)(device_name));
move || (backend)(audio_device));

let (spirc, spirc_task) = Spirc::new(session, player, (self.mixer)());
self.spirc_task = Some(spirc_task);
Expand Down Expand Up @@ -209,7 +209,7 @@ fn main() {
let cache = config.cache;
let session_config = config.session_config;
let backend = config.backend.clone();
let device_name = config.device.clone();
let audio_device = config.audio_device.clone();
let device_id = session_config.device_id.clone();
let discovery_stream = discovery(&handle, session_config.name.clone(), device_id).unwrap();
let connection = if let Some(credentials) =
Expand All @@ -230,7 +230,7 @@ fn main() {
let initial_state = MainLoopState::new(connection,
mixer,
backend,
device_name,
audio_device,
ctrl_c(&handle).flatten_stream().boxed(),
discovery_stream,
cache,
Expand Down

0 comments on commit a238bd8

Please sign in to comment.