mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Remove redundant field names
This commit is contained in:
parent
5616004dbe
commit
059b9029de
5 changed files with 52 additions and 59 deletions
|
@ -51,11 +51,11 @@ impl Discovery {
|
||||||
let public_key = util::powm(&DH_GENERATOR, &private_key, &DH_PRIME);
|
let public_key = util::powm(&DH_GENERATOR, &private_key, &DH_PRIME);
|
||||||
|
|
||||||
let discovery = Discovery(Arc::new(DiscoveryInner {
|
let discovery = Discovery(Arc::new(DiscoveryInner {
|
||||||
config: config,
|
config,
|
||||||
device_id: device_id,
|
device_id,
|
||||||
private_key: private_key,
|
private_key,
|
||||||
public_key: public_key,
|
public_key,
|
||||||
tx: tx,
|
tx,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
(discovery, rx)
|
(discovery, rx)
|
||||||
|
|
|
@ -287,27 +287,27 @@ impl Spirc {
|
||||||
let player_events = player.get_player_event_channel();
|
let player_events = player.get_player_event_channel();
|
||||||
|
|
||||||
let mut task = SpircTask {
|
let mut task = SpircTask {
|
||||||
player: player,
|
player,
|
||||||
mixer: mixer,
|
mixer,
|
||||||
config: task_config,
|
config: task_config,
|
||||||
|
|
||||||
sequence: SeqGenerator::new(1),
|
sequence: SeqGenerator::new(1),
|
||||||
|
|
||||||
ident: ident,
|
ident,
|
||||||
|
|
||||||
device: device,
|
device,
|
||||||
state: initial_state(),
|
state: initial_state(),
|
||||||
play_request_id: None,
|
play_request_id: None,
|
||||||
mixer_started: false,
|
mixer_started: false,
|
||||||
play_status: SpircPlayStatus::Stopped,
|
play_status: SpircPlayStatus::Stopped,
|
||||||
|
|
||||||
subscription: subscription,
|
subscription,
|
||||||
sender: sender,
|
sender,
|
||||||
commands: Some(cmd_rx),
|
commands: Some(cmd_rx),
|
||||||
player_events: Some(player_events),
|
player_events: Some(player_events),
|
||||||
|
|
||||||
shutdown: false,
|
shutdown: false,
|
||||||
session: session,
|
session,
|
||||||
|
|
||||||
context_fut: Box::pin(future::pending()),
|
context_fut: Box::pin(future::pending()),
|
||||||
autoplay_fut: Box::pin(future::pending()),
|
autoplay_fut: Box::pin(future::pending()),
|
||||||
|
@ -1293,10 +1293,7 @@ impl<'a> CommandSender<'a> {
|
||||||
frame.set_typ(cmd);
|
frame.set_typ(cmd);
|
||||||
frame.set_device_state(spirc.device.clone());
|
frame.set_device_state(spirc.device.clone());
|
||||||
frame.set_state_update_id(spirc.now_ms());
|
frame.set_state_update_id(spirc.now_ms());
|
||||||
CommandSender {
|
CommandSender { spirc, frame }
|
||||||
spirc: spirc,
|
|
||||||
frame: frame,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recipient(mut self, recipient: &'a str) -> CommandSender {
|
fn recipient(mut self, recipient: &'a str) -> CommandSender {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![allow(clippy::unused_io_amount)]
|
#![allow(clippy::unused_io_amount)]
|
||||||
#![allow(clippy::redundant_field_names)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
@ -85,7 +84,7 @@ impl AudioFiles for Track {
|
||||||
async fn get_audio_item(session: &Session, id: SpotifyId) -> Result<AudioItem, MercuryError> {
|
async fn get_audio_item(session: &Session, id: SpotifyId) -> Result<AudioItem, MercuryError> {
|
||||||
let item = Self::get(session, id).await?;
|
let item = Self::get(session, id).await?;
|
||||||
Ok(AudioItem {
|
Ok(AudioItem {
|
||||||
id: id,
|
id,
|
||||||
uri: format!("spotify:track:{}", id.to_base62()),
|
uri: format!("spotify:track:{}", id.to_base62()),
|
||||||
files: item.files,
|
files: item.files,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
@ -102,7 +101,7 @@ impl AudioFiles for Episode {
|
||||||
let item = Self::get(session, id).await?;
|
let item = Self::get(session, id).await?;
|
||||||
|
|
||||||
Ok(AudioItem {
|
Ok(AudioItem {
|
||||||
id: id,
|
id,
|
||||||
uri: format!("spotify:episode:{}", id.to_base62()),
|
uri: format!("spotify:episode:{}", id.to_base62()),
|
||||||
files: item.files,
|
files: item.files,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
@ -222,8 +221,8 @@ impl Metadata for Track {
|
||||||
name: msg.get_name().to_owned(),
|
name: msg.get_name().to_owned(),
|
||||||
duration: msg.get_duration(),
|
duration: msg.get_duration(),
|
||||||
album: SpotifyId::from_raw(msg.get_album().get_gid()).unwrap(),
|
album: SpotifyId::from_raw(msg.get_album().get_gid()).unwrap(),
|
||||||
artists: artists,
|
artists,
|
||||||
files: files,
|
files,
|
||||||
alternatives: msg
|
alternatives: msg
|
||||||
.get_alternative()
|
.get_alternative()
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -272,9 +271,9 @@ impl Metadata for Album {
|
||||||
Album {
|
Album {
|
||||||
id: SpotifyId::from_raw(msg.get_gid()).unwrap(),
|
id: SpotifyId::from_raw(msg.get_gid()).unwrap(),
|
||||||
name: msg.get_name().to_owned(),
|
name: msg.get_name().to_owned(),
|
||||||
artists: artists,
|
artists,
|
||||||
tracks: tracks,
|
tracks,
|
||||||
covers: covers,
|
covers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +308,7 @@ impl Metadata for Playlist {
|
||||||
Playlist {
|
Playlist {
|
||||||
revision: msg.get_revision().to_vec(),
|
revision: msg.get_revision().to_vec(),
|
||||||
name: msg.get_attributes().get_name().to_owned(),
|
name: msg.get_attributes().get_name().to_owned(),
|
||||||
tracks: tracks,
|
tracks,
|
||||||
user: msg.get_owner_username().to_string(),
|
user: msg.get_owner_username().to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +341,7 @@ impl Metadata for Artist {
|
||||||
Artist {
|
Artist {
|
||||||
id: SpotifyId::from_raw(msg.get_gid()).unwrap(),
|
id: SpotifyId::from_raw(msg.get_gid()).unwrap(),
|
||||||
name: msg.get_name().to_owned(),
|
name: msg.get_name().to_owned(),
|
||||||
top_tracks: top_tracks,
|
top_tracks,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,8 +387,8 @@ impl Metadata for Episode {
|
||||||
duration: msg.get_duration().to_owned(),
|
duration: msg.get_duration().to_owned(),
|
||||||
language: msg.get_language().to_owned(),
|
language: msg.get_language().to_owned(),
|
||||||
show: SpotifyId::from_raw(msg.get_show().get_gid()).unwrap(),
|
show: SpotifyId::from_raw(msg.get_show().get_gid()).unwrap(),
|
||||||
covers: covers,
|
covers,
|
||||||
files: files,
|
files,
|
||||||
available: parse_restrictions(msg.get_restriction(), &country, "premium"),
|
available: parse_restrictions(msg.get_restriction(), &country, "premium"),
|
||||||
explicit: msg.get_explicit().to_owned(),
|
explicit: msg.get_explicit().to_owned(),
|
||||||
}
|
}
|
||||||
|
@ -427,8 +426,8 @@ impl Metadata for Show {
|
||||||
id: SpotifyId::from_raw(msg.get_gid()).unwrap(),
|
id: SpotifyId::from_raw(msg.get_gid()).unwrap(),
|
||||||
name: msg.get_name().to_owned(),
|
name: msg.get_name().to_owned(),
|
||||||
publisher: msg.get_publisher().to_owned(),
|
publisher: msg.get_publisher().to_owned(),
|
||||||
episodes: episodes,
|
episodes,
|
||||||
covers: covers,
|
covers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,10 +204,10 @@ impl NormalisationData {
|
||||||
let album_peak = file.read_f32::<LittleEndian>()?;
|
let album_peak = file.read_f32::<LittleEndian>()?;
|
||||||
|
|
||||||
let r = NormalisationData {
|
let r = NormalisationData {
|
||||||
track_gain_db: track_gain_db,
|
track_gain_db,
|
||||||
track_peak: track_peak,
|
track_peak,
|
||||||
album_gain_db: album_gain_db,
|
album_gain_db,
|
||||||
album_peak: album_peak,
|
album_peak,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(r)
|
Ok(r)
|
||||||
|
@ -1164,8 +1164,8 @@ impl PlayerInternal {
|
||||||
});
|
});
|
||||||
|
|
||||||
self.state = PlayerState::Playing {
|
self.state = PlayerState::Playing {
|
||||||
track_id: track_id,
|
track_id,
|
||||||
play_request_id: play_request_id,
|
play_request_id,
|
||||||
decoder: loaded_track.decoder,
|
decoder: loaded_track.decoder,
|
||||||
normalisation_factor: loaded_track.normalisation_factor,
|
normalisation_factor: loaded_track.normalisation_factor,
|
||||||
stream_loader_controller: loaded_track.stream_loader_controller,
|
stream_loader_controller: loaded_track.stream_loader_controller,
|
||||||
|
@ -1181,8 +1181,8 @@ impl PlayerInternal {
|
||||||
self.ensure_sink_stopped(false);
|
self.ensure_sink_stopped(false);
|
||||||
|
|
||||||
self.state = PlayerState::Paused {
|
self.state = PlayerState::Paused {
|
||||||
track_id: track_id,
|
track_id,
|
||||||
play_request_id: play_request_id,
|
play_request_id,
|
||||||
decoder: loaded_track.decoder,
|
decoder: loaded_track.decoder,
|
||||||
normalisation_factor: loaded_track.normalisation_factor,
|
normalisation_factor: loaded_track.normalisation_factor,
|
||||||
stream_loader_controller: loaded_track.stream_loader_controller,
|
stream_loader_controller: loaded_track.stream_loader_controller,
|
||||||
|
@ -1229,7 +1229,7 @@ impl PlayerInternal {
|
||||||
track_id: old_track_id,
|
track_id: old_track_id,
|
||||||
..
|
..
|
||||||
} => self.send_event(PlayerEvent::Changed {
|
} => self.send_event(PlayerEvent::Changed {
|
||||||
old_track_id: old_track_id,
|
old_track_id,
|
||||||
new_track_id: track_id,
|
new_track_id: track_id,
|
||||||
}),
|
}),
|
||||||
PlayerState::Stopped => self.send_event(PlayerEvent::Started {
|
PlayerState::Stopped => self.send_event(PlayerEvent::Started {
|
||||||
|
@ -1726,10 +1726,7 @@ struct Subfile<T: Read + Seek> {
|
||||||
impl<T: Read + Seek> Subfile<T> {
|
impl<T: Read + Seek> Subfile<T> {
|
||||||
pub fn new(mut stream: T, offset: u64) -> Subfile<T> {
|
pub fn new(mut stream: T, offset: u64) -> Subfile<T> {
|
||||||
stream.seek(SeekFrom::Start(offset)).unwrap();
|
stream.seek(SeekFrom::Start(offset)).unwrap();
|
||||||
Subfile {
|
Subfile { stream, offset }
|
||||||
stream: stream,
|
|
||||||
offset: offset,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
src/main.rs
32
src/main.rs
|
@ -353,7 +353,7 @@ fn setup(args: &[String]) -> Setup {
|
||||||
|
|
||||||
SessionConfig {
|
SessionConfig {
|
||||||
user_agent: version::version_string(),
|
user_agent: version::version_string(),
|
||||||
device_id: device_id,
|
device_id,
|
||||||
proxy: matches.opt_str("proxy").or_else(|| std::env::var("http_proxy").ok()).map(
|
proxy: matches.opt_str("proxy").or_else(|| std::env::var("http_proxy").ok()).map(
|
||||||
|s| {
|
|s| {
|
||||||
match Url::parse(&s) {
|
match Url::parse(&s) {
|
||||||
|
@ -393,7 +393,7 @@ fn setup(args: &[String]) -> Setup {
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
PlayerConfig {
|
PlayerConfig {
|
||||||
bitrate: bitrate,
|
bitrate,
|
||||||
gapless: !matches.opt_present("disable-gapless"),
|
gapless: !matches.opt_present("disable-gapless"),
|
||||||
normalisation: matches.opt_present("enable-volume-normalisation"),
|
normalisation: matches.opt_present("enable-volume-normalisation"),
|
||||||
normalisation_type: gain_type,
|
normalisation_type: gain_type,
|
||||||
|
@ -419,10 +419,10 @@ fn setup(args: &[String]) -> Setup {
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
ConnectConfig {
|
ConnectConfig {
|
||||||
name: name,
|
name,
|
||||||
device_type: device_type,
|
device_type,
|
||||||
volume: initial_volume,
|
volume: initial_volume,
|
||||||
volume_ctrl: volume_ctrl,
|
volume_ctrl,
|
||||||
autoplay: matches.opt_present("autoplay"),
|
autoplay: matches.opt_present("autoplay"),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -430,17 +430,17 @@ fn setup(args: &[String]) -> Setup {
|
||||||
let enable_discovery = !matches.opt_present("disable-discovery");
|
let enable_discovery = !matches.opt_present("disable-discovery");
|
||||||
|
|
||||||
Setup {
|
Setup {
|
||||||
backend: backend,
|
backend,
|
||||||
cache: cache,
|
cache,
|
||||||
session_config: session_config,
|
session_config,
|
||||||
player_config: player_config,
|
player_config,
|
||||||
connect_config: connect_config,
|
connect_config,
|
||||||
credentials: credentials,
|
credentials,
|
||||||
device: device,
|
device,
|
||||||
enable_discovery: enable_discovery,
|
enable_discovery,
|
||||||
zeroconf_port: zeroconf_port,
|
zeroconf_port,
|
||||||
mixer: mixer,
|
mixer,
|
||||||
mixer_config: mixer_config,
|
mixer_config,
|
||||||
player_event_program: matches.opt_str("onevent"),
|
player_event_program: matches.opt_str("onevent"),
|
||||||
emit_sink_events: matches.opt_present("emit-sink-events"),
|
emit_sink_events: matches.opt_present("emit-sink-events"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue