Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix crashing when attempting to add a song to a playlist
- Fix incorrect shuffle order after appending a track while shuffle is enabled

### Changed

- Sort albums by date they were added in the library view, rather than lexically.

## [1.3.3]

### Fixed
Expand Down
12 changes: 6 additions & 6 deletions src/library.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::cmp::Reverse;
use std::collections::HashMap;
use std::fs::File;
use std::iter::Iterator;
Expand Down Expand Up @@ -465,12 +466,13 @@ impl Library {
.strip_prefix("The ")
.unwrap_or(&album.artists[0]);
let album_title = album.title.strip_prefix("The ").unwrap_or(&album.title);
format!(
"{}{}{}",
Reverse(format!(
"{:?}{}{}{}",
album.added_at,
album_artist.to_lowercase(),
album.year,
album_title.to_lowercase()
)
))
});

*self.albums.write().unwrap() = albums;
Expand Down Expand Up @@ -725,10 +727,8 @@ impl Library {
{
let mut store = self.albums.write().unwrap();
if !store.iter().any(|a| a.id == album.id) {
// just insert at the beginning, since that's recency
store.insert(0, album.clone());

// resort list of albums
store.sort_unstable_by_key(|a| format!("{}{}{}", a.artists[0], a.year, a.title));
}
}

Expand Down