sort artist albums by year
This commit is contained in:
@@ -39,10 +39,7 @@ impl Artist {
|
|||||||
for album in albums {
|
for album in albums {
|
||||||
album.load_tracks(spotify.clone());
|
album.load_tracks(spotify.clone());
|
||||||
}
|
}
|
||||||
return;
|
} else if let Some(ref artist_id) = self.id {
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref artist_id) = self.id {
|
|
||||||
let mut collected_ids: Vec<String> = Vec::new();
|
let mut collected_ids: Vec<String> = Vec::new();
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
while let Some(sas) = spotify.artist_albums(artist_id, 50, offset) {
|
while let Some(sas) = spotify.artist_albums(artist_id, 50, offset) {
|
||||||
@@ -70,6 +67,9 @@ impl Artist {
|
|||||||
};
|
};
|
||||||
self.albums = Some(albums);
|
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>> {
|
fn tracks(&self) -> Option<Vec<&Track>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user