mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Make standard metadata get handle also playlists
This commit is contained in:
parent
d732cae976
commit
db9f3cbdd4
1 changed files with 2 additions and 15 deletions
|
@ -201,21 +201,8 @@ impl Metadata for Album {
|
|||
impl Metadata for Playlist {
|
||||
type Message = protocol::playlist4changes::SelectedListContent;
|
||||
|
||||
fn base_url() -> &'static str {
|
||||
"hm://playlist/v2/playlist"
|
||||
}
|
||||
|
||||
fn get(session: &Session, id: SpotifyId) -> Box<Future<Item = Self, Error = MercuryError>> {
|
||||
let uri = format!("{}/{}", Self::base_url(), id.to_base62());
|
||||
let request = session.mercury().get(uri);
|
||||
|
||||
let session = session.clone();
|
||||
Box::new(request.and_then(move |response| {
|
||||
let data = response.payload.first().expect("Empty payload");
|
||||
let msg: Self::Message = protobuf::parse_from_bytes(data).unwrap();
|
||||
|
||||
Ok(Self::parse(&msg, &session))
|
||||
}))
|
||||
fn request_url(id: SpotifyId) -> String {
|
||||
format!("hm://playlist/v2/playlist/{}", id.to_base62())
|
||||
}
|
||||
|
||||
fn parse(msg: &Self::Message, _: &Session) -> Self {
|
||||
|
|
Loading…
Reference in a new issue