sort artist albums by year

This commit is contained in:
Henrik Friedrichsen
2021-03-22 22:16:07 +01:00
parent a0231362f1
commit 5295eb4b5a

View File

@@ -39,10 +39,7 @@ impl Artist {
for album in albums {
album.load_tracks(spotify.clone());
}
return;
}
if let Some(ref artist_id) = self.id {
} else if let Some(ref artist_id) = self.id {
let mut collected_ids: Vec<String> = Vec::new();
let mut offset = 0;
while let Some(sas) = spotify.artist_albums(artist_id, 50, offset) {
@@ -70,6 +67,9 @@ impl Artist {
};
self.albums = Some(albums);
}
if let Some(ref mut albums) = self.albums {
albums.sort_by(|a, b| b.year.cmp(&a.year));
}
}
fn tracks(&self) -> Option<Vec<&Track>> {