mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Fix warnings
This commit is contained in:
parent
3134e1a0c5
commit
041f084d7f
8 changed files with 14 additions and 11 deletions
|
@ -272,7 +272,7 @@ impl Spirc {
|
||||||
.flatten_stream()
|
.flatten_stream()
|
||||||
.map(|response| -> Frame {
|
.map(|response| -> Frame {
|
||||||
let data = response.payload.first().unwrap();
|
let data = response.payload.first().unwrap();
|
||||||
protobuf::parse_from_bytes(data).unwrap()
|
Frame::parse_from_bytes(data).unwrap()
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ where
|
||||||
let header = read_into_accumulator(connection, 4, acc).await?;
|
let header = read_into_accumulator(connection, 4, acc).await?;
|
||||||
let size = BigEndian::read_u32(header) as usize;
|
let size = BigEndian::read_u32(header) as usize;
|
||||||
let data = read_into_accumulator(connection, size - 4, acc).await?;
|
let data = read_into_accumulator(connection, size - 4, acc).await?;
|
||||||
let message = protobuf::parse_from_bytes(data).unwrap();
|
let message = M::parse_from_bytes(data).unwrap();
|
||||||
Ok(message)
|
Ok(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ pub async fn authenticate(
|
||||||
let (cmd, data) = transport.next().await.expect("EOF")?;
|
let (cmd, data) = transport.next().await.expect("EOF")?;
|
||||||
match cmd {
|
match cmd {
|
||||||
0xac => {
|
0xac => {
|
||||||
let welcome_data: APWelcome = protobuf::parse_from_bytes(data.as_ref())?;
|
let welcome_data = APWelcome::parse_from_bytes(data.as_ref())?;
|
||||||
|
|
||||||
let reusable_credentials = Credentials {
|
let reusable_credentials = Credentials {
|
||||||
username: welcome_data.get_canonical_username().to_owned(),
|
username: welcome_data.get_canonical_username().to_owned(),
|
||||||
|
@ -157,7 +157,7 @@ pub async fn authenticate(
|
||||||
Ok(reusable_credentials)
|
Ok(reusable_credentials)
|
||||||
}
|
}
|
||||||
0xad => {
|
0xad => {
|
||||||
let error_data: APLoginFailed = protobuf::parse_from_bytes(data.as_ref())?;
|
let error_data = APLoginFailed::parse_from_bytes(data.as_ref())?;
|
||||||
Err(error_data.into())
|
Err(error_data.into())
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use std::task::Poll;
|
||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use futures_util::FutureExt;
|
use futures_util::FutureExt;
|
||||||
|
use protobuf::Message;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|
||||||
use crate::protocol;
|
use crate::protocol;
|
||||||
|
@ -123,8 +124,8 @@ impl MercuryManager {
|
||||||
if !response.payload.is_empty() {
|
if !response.payload.is_empty() {
|
||||||
// Old subscription protocol, watch the provided list of URIs
|
// Old subscription protocol, watch the provided list of URIs
|
||||||
for sub in response.payload {
|
for sub in response.payload {
|
||||||
let mut sub: protocol::pubsub::Subscription =
|
let mut sub =
|
||||||
protobuf::parse_from_bytes(&sub).unwrap();
|
protocol::pubsub::Subscription::parse_from_bytes(&sub).unwrap();
|
||||||
let sub_uri = sub.take_uri();
|
let sub_uri = sub.take_uri();
|
||||||
|
|
||||||
debug!("subscribed sub_uri={}", sub_uri);
|
debug!("subscribed sub_uri={}", sub_uri);
|
||||||
|
@ -192,7 +193,7 @@ impl MercuryManager {
|
||||||
|
|
||||||
fn complete_request(&self, cmd: u8, mut pending: MercuryPending) {
|
fn complete_request(&self, cmd: u8, mut pending: MercuryPending) {
|
||||||
let header_data = pending.parts.remove(0);
|
let header_data = pending.parts.remove(0);
|
||||||
let header: protocol::mercury::Header = protobuf::parse_from_bytes(&header_data).unwrap();
|
let header = protocol::mercury::Header::parse_from_bytes(&header_data).unwrap();
|
||||||
|
|
||||||
let response = MercuryResponse {
|
let response = MercuryResponse {
|
||||||
uri: header.get_uri().to_string(),
|
uri: header.get_uri().to_string(),
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(clippy::wrong_self_convention)]
|
||||||
|
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use env_logger;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use librespot::core::authentication::Credentials;
|
use librespot::core::authentication::Credentials;
|
||||||
|
|
|
@ -14,6 +14,7 @@ use librespot_core::mercury::MercuryError;
|
||||||
use librespot_core::session::Session;
|
use librespot_core::session::Session;
|
||||||
use librespot_core::spotify_id::{FileId, SpotifyAudioType, SpotifyId};
|
use librespot_core::spotify_id::{FileId, SpotifyAudioType, SpotifyId};
|
||||||
use librespot_protocol as protocol;
|
use librespot_protocol as protocol;
|
||||||
|
use protobuf::Message;
|
||||||
|
|
||||||
pub use crate::protocol::metadata::AudioFile_Format as FileFormat;
|
pub use crate::protocol::metadata::AudioFile_Format as FileFormat;
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ pub trait Metadata: Send + Sized + 'static {
|
||||||
let uri = Self::request_url(id);
|
let uri = Self::request_url(id);
|
||||||
let response = session.mercury().get(uri).await?;
|
let response = session.mercury().get(uri).await?;
|
||||||
let data = response.payload.first().expect("Empty payload");
|
let data = response.payload.first().expect("Empty payload");
|
||||||
let msg: Self::Message = protobuf::parse_from_bytes(data).unwrap();
|
let msg = Self::Message::parse_from_bytes(data).unwrap();
|
||||||
|
|
||||||
Ok(Self::parse(&msg, &session))
|
Ok(Self::parse(&msg, &session))
|
||||||
}
|
}
|
||||||
|
|
|
@ -538,10 +538,10 @@ impl PlayerState {
|
||||||
play_request_id,
|
play_request_id,
|
||||||
loaded_track: PlayerLoadedTrackData {
|
loaded_track: PlayerLoadedTrackData {
|
||||||
decoder,
|
decoder,
|
||||||
duration_ms,
|
|
||||||
bytes_per_second,
|
|
||||||
normalisation_factor,
|
normalisation_factor,
|
||||||
stream_loader_controller,
|
stream_loader_controller,
|
||||||
|
bytes_per_second,
|
||||||
|
duration_ms,
|
||||||
stream_position_pcm,
|
stream_position_pcm,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue