mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Fix alternative tracks
This commit is contained in:
parent
643b39b40e
commit
b7c047bca2
1 changed files with 5 additions and 1 deletions
|
@ -694,7 +694,10 @@ struct PlayerTrackLoader {
|
||||||
|
|
||||||
impl PlayerTrackLoader {
|
impl PlayerTrackLoader {
|
||||||
async fn find_available_alternative(&self, audio: AudioItem) -> Option<AudioItem> {
|
async fn find_available_alternative(&self, audio: AudioItem) -> Option<AudioItem> {
|
||||||
if audio.availability.is_ok() {
|
if let Err(e) = audio.availability {
|
||||||
|
error!("Track is unavailable: {}", e);
|
||||||
|
None
|
||||||
|
} else if !audio.files.is_empty() {
|
||||||
Some(audio)
|
Some(audio)
|
||||||
} else if let Some(alternatives) = &audio.alternatives {
|
} else if let Some(alternatives) = &audio.alternatives {
|
||||||
let alternatives: FuturesUnordered<_> = alternatives
|
let alternatives: FuturesUnordered<_> = alternatives
|
||||||
|
@ -708,6 +711,7 @@ impl PlayerTrackLoader {
|
||||||
.next()
|
.next()
|
||||||
.await
|
.await
|
||||||
} else {
|
} else {
|
||||||
|
error!("Track should be available, but no alternatives found.");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue