1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00

Get user attributes and updates

This commit is contained in:
Roderick van Domburg 2021-12-11 00:03:35 +01:00
parent 40163754bb
commit 9a0d2390b7
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451
7 changed files with 220 additions and 2 deletions

View file

@ -144,6 +144,27 @@ impl MercuryManager {
}
}
pub fn listen_for<T: Into<String>>(
&self,
uri: T,
) -> impl Future<Output = mpsc::UnboundedReceiver<MercuryResponse>> + 'static {
let uri = uri.into();
let manager = self.clone();
async move {
let (tx, rx) = mpsc::unbounded_channel();
manager.lock(move |inner| {
if !inner.invalid {
debug!("listening to uri={}", uri);
inner.subscriptions.push((uri, tx));
}
});
rx
}
}
pub(crate) fn dispatch(&self, cmd: PacketType, mut data: Bytes) {
let seq_len = BigEndian::read_u16(data.split_to(2).as_ref()) as usize;
let seq = data.split_to(seq_len).as_ref().to_owned();