adapt to new rspotify structures

these changes are necessary to handle playlists with local tracks properly
This commit is contained in:
Henrik Friedrichsen
2019-04-17 18:25:00 +02:00
parent 0bbba3c57d
commit 0de6ad2dfe
6 changed files with 64 additions and 29 deletions

View File

@@ -31,8 +31,10 @@ impl Artist {
continue;
}
if let Some(fa) = spotify.full_album(&sa.id).as_ref() {
albums.push(fa.into());
if let Some(album_id) = sa.id {
if let Some(fa) = spotify.full_album(&album_id).as_ref() {
albums.push(fa.into());
}
}
}
@@ -86,9 +88,14 @@ impl ListItem for Artist {
.read()
.unwrap()
.iter()
.map(|t| t.id.clone())
.filter(|t| t.id.is_some())
.map(|t| t.id.clone().unwrap())
.collect();
let ids: Vec<String> = tracks
.iter()
.filter(|t| t.id.is_some())
.map(|t| t.id.clone().unwrap())
.collect();
let ids: Vec<String> = tracks.iter().map(|t| t.id.clone()).collect();
!ids.is_empty() && playing == ids
} else {
false