1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 09:49:31 +02:00

Re-Add ability to handle/play tracks (#1468)

* re-add support to play a set of tracks

* connect: reduce some cloning

* connect: derive clone for LoadRequest

* apply review, improve function naming

* clippy fix
This commit is contained in:
Felix Prillwitz 2025-05-04 20:29:54 +02:00 committed by GitHub
parent e2c3ac3146
commit 8b729540f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 213 additions and 85 deletions

View file

@ -1,4 +1,4 @@
use crate::context::Context;
use crate::{context::Context, context_page::ContextPage, context_track::ContextTrack};
use protobuf::Message;
use std::hash::{Hash, Hasher};
@ -11,3 +11,27 @@ impl Hash for Context {
}
impl Eq for Context {}
impl From<Vec<String>> for ContextPage {
fn from(value: Vec<String>) -> Self {
ContextPage {
tracks: value
.into_iter()
.map(|uri| ContextTrack {
uri: Some(uri),
..Default::default()
})
.collect(),
..Default::default()
}
}
}
impl From<Vec<ContextTrack>> for ContextPage {
fn from(tracks: Vec<ContextTrack>) -> Self {
ContextPage {
tracks,
..Default::default()
}
}
}