fix: ignore extraction error when fetching album playlist
This commit is contained in:
parent
ee5e82f6bb
commit
49148711e0
1 changed files with 19 additions and 15 deletions
|
|
@ -75,23 +75,27 @@ impl RustyPipeQuery {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if !to_replace.is_empty() {
|
if !to_replace.is_empty() {
|
||||||
let playlist = self.music_playlist(playlist_id).await?;
|
match self.music_playlist(playlist_id).await {
|
||||||
|
Ok(playlist) => {
|
||||||
for (i, title) in to_replace {
|
for (i, title) in to_replace {
|
||||||
let found_track = playlist.tracks.items.iter().find_map(|track| {
|
let found_track = playlist.tracks.items.iter().find_map(|track| {
|
||||||
if track.name == title && !track.is_video {
|
if track.name == title && !track.is_video {
|
||||||
Some((track.id.to_owned(), track.duration))
|
Some((track.id.to_owned(), track.duration))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if let Some((track_id, duration)) = found_track {
|
||||||
|
album.tracks[i].id = track_id;
|
||||||
|
if let Some(duration) = duration {
|
||||||
|
album.tracks[i].duration = Some(duration);
|
||||||
|
}
|
||||||
|
album.tracks[i].is_video = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if let Some((track_id, duration)) = found_track {
|
|
||||||
album.tracks[i].id = track_id;
|
|
||||||
if let Some(duration) = duration {
|
|
||||||
album.tracks[i].duration = Some(duration);
|
|
||||||
}
|
|
||||||
album.tracks[i].is_video = false;
|
|
||||||
}
|
}
|
||||||
|
Err(Error::Extraction(_)) => {}
|
||||||
|
Err(e) => return Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue