From 7a77a7756947afe3e36a1d8142775b3ddefc620f Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Wed, 24 May 2023 14:43:44 -0700 Subject: [PATCH] Playlist page - show track's original position in playlist for # column --- ui/browsing/playlistpage.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/browsing/playlistpage.go b/ui/browsing/playlistpage.go index 1f14404..2d3b74e 100644 --- a/ui/browsing/playlistpage.go +++ b/ui/browsing/playlistpage.go @@ -70,7 +70,6 @@ func newPlaylistPage( a.tracklist.OnVisibleColumnsChanged = func(cols []string) { conf.TracklistColumns = cols } - a.tracklist.AutoNumber = true reorderMenu := fyne.NewMenuItem("Reorder tracks", nil) reorderMenu.ChildMenu = fyne.NewMenu("", []*fyne.MenuItem{ fyne.NewMenuItem("Move to top", a.onMoveSelectedToTop), @@ -133,6 +132,12 @@ func (a *PlaylistPage) load() { log.Printf("Failed to get playlist: %s", err.Error()) return } + // Playlists, like albums, have a sequential running order. We want the number column to + // represent the track's original position in the playlist, if the user applies a sort. + // Re-purpose the TrackNumber field for the track's position in the playlist, rather than its parent album. + for i, tr := range playlist.Tracks { + tr.TrackNumber = i + 1 + } a.tracks = playlist.Tracks a.tracklist.SetTracks(playlist.Tracks) a.tracklist.SetNowPlaying(a.nowPlayingID)