Fix alternative tracks

This commit is contained in:
Roderick van Domburg 2021-12-27 09:35:11 +01:00
parent 643b39b40e
commit b7c047bca2
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451

View file

@ -694,7 +694,10 @@ struct PlayerTrackLoader {
impl PlayerTrackLoader {
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)
} else if let Some(alternatives) = &audio.alternatives {
let alternatives: FuturesUnordered<_> = alternatives
@ -708,6 +711,7 @@ impl PlayerTrackLoader {
.next()
.await
} else {
error!("Track should be available, but no alternatives found.");
None
}
}