Merge branch '287-sort-by-tracknumber' into 'master'
UI: Sort songs by track number in Browse mode See merge request sublime-music/sublime-music!69
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) -> Tuple[Optional[int], Optional[int]]:
|
||||
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