mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #421 from ashthespy/autoplay
Don't panic when no autoplay uri is obtained
This commit is contained in:
commit
2a1482c880
1 changed files with 8 additions and 4 deletions
|
@ -795,10 +795,14 @@ impl SpircTask {
|
||||||
let query_uri = format!("hm://autoplay-enabled/query?uri={}", uri);
|
let query_uri = format!("hm://autoplay-enabled/query?uri={}", uri);
|
||||||
let request = self.session.mercury().get(query_uri);
|
let request = self.session.mercury().get(query_uri);
|
||||||
Box::new(request.and_then(move |response| {
|
Box::new(request.and_then(move |response| {
|
||||||
let data = response.payload.first().expect("Empty autoplay uri").to_vec();
|
if response.status_code == 200 {
|
||||||
let autoplay_uri = String::from_utf8(data).unwrap();
|
let data = response.payload.first().expect("Empty autoplay uri").to_vec();
|
||||||
|
let autoplay_uri = String::from_utf8(data).unwrap();
|
||||||
Ok(autoplay_uri)
|
Ok(autoplay_uri)
|
||||||
|
} else {
|
||||||
|
warn!("No autoplay_uri found");
|
||||||
|
Err(MercuryError)
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue