fix: Don't crash when attempting to download local tracks by skipping them (#88)

Co-authored-by: 0xnf <0xnf@winetech.com>
This commit is contained in:
0xNF 2024-07-11 11:04:06 +09:00 committed by GitHub
parent 606a561689
commit cc7a03b774
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -84,7 +84,11 @@ impl Downloader {
let uri = Spotify::parse_uri(uri)?; let uri = Spotify::parse_uri(uri)?;
let item = self.spotify.resolve_uri(&uri).await?; let item = self.spotify.resolve_uri(&uri).await?;
match item { match item {
SpotifyItem::Track(t) => self.add_to_queue(t.into()).await, SpotifyItem::Track(t) => {
if !t.is_local {
self.add_to_queue(t.into()).await;
}
}
SpotifyItem::Album(a) => { SpotifyItem::Album(a) => {
let tracks = self.spotify.full_album(&a.id).await?; let tracks = self.spotify.full_album(&a.id).await?;
let queue: Vec<Download> = tracks.into_iter().map(|t| t.into()).collect(); let queue: Vec<Download> = tracks.into_iter().map(|t| t.into()).collect();