UI: Sort songs by track number in Browse mode
This commit may address issue #287. It simply takes the list of songs provided by the server in Browse mode and sorts it by disc and track number. Tests seem to have passed except for (unrelated?) mypy issues.
This commit is contained in:
@@ -377,6 +377,14 @@ class MusicDirectoryList(Gtk.Box):
|
||||
self.drilldown_directories_store, new_directories_store
|
||||
)
|
||||
|
||||
def song_sort_key(song: API.Song):
|
||||
return (
|
||||
song.disc_number if hasattr(song, "disc_number") else 0,
|
||||
song.track if hasattr(song, "track") else 0,
|
||||
)
|
||||
|
||||
songs.sort(key=song_sort_key)
|
||||
|
||||
new_songs_store = [
|
||||
[
|
||||
(
|
||||
|
Reference in New Issue
Block a user