Add Comment column to tracklist
This commit is contained in:
@@ -101,6 +101,7 @@ type Track struct {
|
|||||||
PlayCount int
|
PlayCount int
|
||||||
FilePath string
|
FilePath string
|
||||||
BitRate int
|
BitRate int
|
||||||
|
Comment string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Playlist struct {
|
type Playlist struct {
|
||||||
|
|||||||
@@ -360,6 +360,7 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
|
|||||||
FilePath: ch.Path,
|
FilePath: ch.Path,
|
||||||
Size: ch.Size,
|
Size: ch.Size,
|
||||||
BitRate: ch.BitRate,
|
BitRate: ch.BitRate,
|
||||||
|
Comment: ch.Comment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ require (
|
|||||||
github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1
|
github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1
|
||||||
github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc
|
github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc
|
||||||
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee
|
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee
|
||||||
github.com/dweymouth/go-subsonic v0.0.0-20231216190641-c537a36d520c
|
github.com/dweymouth/go-subsonic v0.0.0-20231216234924-3f62122dc53a
|
||||||
github.com/fsnotify/fsnotify v1.6.0
|
github.com/fsnotify/fsnotify v1.6.0
|
||||||
github.com/godbus/dbus/v5 v5.1.0
|
github.com/godbus/dbus/v5 v5.1.0
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc h1:wJy4U12Ys
|
|||||||
github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc/go.mod h1:BMwS4vdjEYf1gmjPGSKCzWP/I6YlI6fkefJ9nsjBjaU=
|
github.com/dweymouth/go-jellyfin v0.0.0-20231116161116-e800860bdacc/go.mod h1:BMwS4vdjEYf1gmjPGSKCzWP/I6YlI6fkefJ9nsjBjaU=
|
||||||
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee h1:ZGyJ6wp7CAfT31BugypcF/TPKEy2RrGR9JFq1JOjOpY=
|
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee h1:ZGyJ6wp7CAfT31BugypcF/TPKEy2RrGR9JFq1JOjOpY=
|
||||||
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee/go.mod h1:Ov0ieN90M7i+0k3OxhA/g1dozGs+UcPHDsMKqPgRDk0=
|
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee/go.mod h1:Ov0ieN90M7i+0k3OxhA/g1dozGs+UcPHDsMKqPgRDk0=
|
||||||
github.com/dweymouth/go-subsonic v0.0.0-20231216190641-c537a36d520c h1:48xbtXN53Rrru1Y3Ywd/FIVohH4NoRMzvxEY4aY1s0M=
|
github.com/dweymouth/go-subsonic v0.0.0-20231216234924-3f62122dc53a h1:UJcwloSIzRpUOIwRE207JF2SHoTmOg7vJWzfQWpztSk=
|
||||||
github.com/dweymouth/go-subsonic v0.0.0-20231216190641-c537a36d520c/go.mod h1:OWtcumdQsan8uM6wmx6PqKhldaCthH10CQ+vb+94kzo=
|
github.com/dweymouth/go-subsonic v0.0.0-20231216234924-3f62122dc53a/go.mod h1:OWtcumdQsan8uM6wmx6PqKhldaCthH10CQ+vb+94kzo=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
|
|||||||
+16
-6
@@ -32,14 +32,17 @@ const (
|
|||||||
ColumnFavorite = "Favorite"
|
ColumnFavorite = "Favorite"
|
||||||
ColumnRating = "Rating"
|
ColumnRating = "Rating"
|
||||||
ColumnPlays = "Plays"
|
ColumnPlays = "Plays"
|
||||||
|
ColumnComment = "Comment"
|
||||||
ColumnBitrate = "Bitrate"
|
ColumnBitrate = "Bitrate"
|
||||||
ColumnSize = "Size"
|
ColumnSize = "Size"
|
||||||
ColumnPath = "Path"
|
ColumnPath = "Path"
|
||||||
|
|
||||||
|
numColumns = 13
|
||||||
)
|
)
|
||||||
|
|
||||||
var columns = []string{
|
var columns = []string{
|
||||||
ColumnNum, ColumnTitle, ColumnArtist, ColumnAlbum, ColumnTime, ColumnYear,
|
ColumnNum, ColumnTitle, ColumnArtist, ColumnAlbum, ColumnTime, ColumnYear, ColumnFavorite,
|
||||||
ColumnFavorite, ColumnRating, ColumnPlays, ColumnBitrate, ColumnSize, ColumnPath,
|
ColumnRating, ColumnPlays, ColumnComment, ColumnBitrate, ColumnSize, ColumnPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
type TracklistSort struct {
|
type TracklistSort struct {
|
||||||
@@ -114,15 +117,15 @@ type trackModel struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewTracklist(tracks []*mediaprovider.Track) *Tracklist {
|
func NewTracklist(tracks []*mediaprovider.Track) *Tracklist {
|
||||||
t := &Tracklist{visibleColumns: make([]bool, 12)}
|
t := &Tracklist{visibleColumns: make([]bool, numColumns)}
|
||||||
t.ExtendBaseWidget(t)
|
t.ExtendBaseWidget(t)
|
||||||
|
|
||||||
if len(tracks) > 0 {
|
if len(tracks) > 0 {
|
||||||
t._setTracks(tracks)
|
t._setTracks(tracks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #, Title, Artist, Album, Time, Year, Favorite, Rating, Plays, Bitrate, Size, Path
|
// #, Title, Artist, Album, Time, Year, Favorite, Rating, Plays, Comment, Bitrate, Size, Path
|
||||||
t.colLayout = layouts.NewColumnsLayout([]float32{40, -1, -1, -1, 60, 60, 55, 100, 65, 75, 75, -1})
|
t.colLayout = layouts.NewColumnsLayout([]float32{40, -1, -1, -1, 60, 60, 55, 100, 65, -1, 75, 75, -1})
|
||||||
t.buildHeader()
|
t.buildHeader()
|
||||||
t.hdr.OnColumnSortChanged = t.onSorted
|
t.hdr.OnColumnSortChanged = t.onSorted
|
||||||
t.hdr.OnColumnVisibilityChanged = t.setColumnVisible
|
t.hdr.OnColumnVisibilityChanged = t.setColumnVisible
|
||||||
@@ -190,6 +193,7 @@ func (t *Tracklist) buildHeader() {
|
|||||||
{Text: " Fav.", Alignment: fyne.TextAlignCenter, CanToggleVisible: true},
|
{Text: " Fav.", Alignment: fyne.TextAlignCenter, CanToggleVisible: true},
|
||||||
{Text: "Rating", Alignment: fyne.TextAlignLeading, CanToggleVisible: true},
|
{Text: "Rating", Alignment: fyne.TextAlignLeading, CanToggleVisible: true},
|
||||||
{Text: "Plays", Alignment: fyne.TextAlignTrailing, CanToggleVisible: true},
|
{Text: "Plays", Alignment: fyne.TextAlignTrailing, CanToggleVisible: true},
|
||||||
|
{Text: "Comment", Alignment: fyne.TextAlignLeading, CanToggleVisible: true},
|
||||||
{Text: "Bitrate", Alignment: fyne.TextAlignTrailing, CanToggleVisible: true},
|
{Text: "Bitrate", Alignment: fyne.TextAlignTrailing, CanToggleVisible: true},
|
||||||
{Text: "Size", Alignment: fyne.TextAlignTrailing, CanToggleVisible: true},
|
{Text: "Size", Alignment: fyne.TextAlignTrailing, CanToggleVisible: true},
|
||||||
{Text: "File Path", Alignment: fyne.TextAlignLeading, CanToggleVisible: true}},
|
{Text: "File Path", Alignment: fyne.TextAlignLeading, CanToggleVisible: true}},
|
||||||
@@ -440,6 +444,8 @@ func (t *Tracklist) doSortTracks() {
|
|||||||
t.intSort(func(tr *trackModel) int64 { return tr.track.Size })
|
t.intSort(func(tr *trackModel) int64 { return tr.track.Size })
|
||||||
case ColumnPlays:
|
case ColumnPlays:
|
||||||
t.intSort(func(tr *trackModel) int64 { return int64(tr.track.PlayCount) })
|
t.intSort(func(tr *trackModel) int64 { return int64(tr.track.PlayCount) })
|
||||||
|
case ColumnComment:
|
||||||
|
t.stringSort(func(tr *trackModel) string { return tr.track.Comment })
|
||||||
case ColumnBitrate:
|
case ColumnBitrate:
|
||||||
t.intSort(func(tr *trackModel) int64 { return int64(tr.track.BitRate) })
|
t.intSort(func(tr *trackModel) int64 { return int64(tr.track.BitRate) })
|
||||||
case ColumnFavorite:
|
case ColumnFavorite:
|
||||||
@@ -713,6 +719,7 @@ type TrackRow struct {
|
|||||||
rating *StarRating
|
rating *StarRating
|
||||||
bitrate *widget.Label
|
bitrate *widget.Label
|
||||||
plays *widget.Label
|
plays *widget.Label
|
||||||
|
comment *widget.Label
|
||||||
size *widget.Label
|
size *widget.Label
|
||||||
path *widget.Label
|
path *widget.Label
|
||||||
|
|
||||||
@@ -741,12 +748,13 @@ func NewTrackRow(tracklist *Tracklist, playingIcon fyne.CanvasObject) *TrackRow
|
|||||||
t.rating.StarSize = 16
|
t.rating.StarSize = 16
|
||||||
t.rating.OnRatingChanged = t.setTrackRating
|
t.rating.OnRatingChanged = t.setTrackRating
|
||||||
t.plays = newTrailingAlignLabel()
|
t.plays = newTrailingAlignLabel()
|
||||||
|
t.comment = newTruncatingLabel()
|
||||||
t.bitrate = newTrailingAlignLabel()
|
t.bitrate = newTrailingAlignLabel()
|
||||||
t.size = newTrailingAlignLabel()
|
t.size = newTrailingAlignLabel()
|
||||||
t.path = newTruncatingLabel()
|
t.path = newTruncatingLabel()
|
||||||
|
|
||||||
t.Content = container.New(tracklist.colLayout,
|
t.Content = container.New(tracklist.colLayout,
|
||||||
t.num, t.name, t.artist, t.album, t.dur, t.year, t.favorite, t.rating, t.plays, t.bitrate, t.size, t.path)
|
t.num, t.name, t.artist, t.album, t.dur, t.year, t.favorite, t.rating, t.plays, t.comment, t.bitrate, t.size, t.path)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,6 +796,7 @@ func (t *TrackRow) Update(tm *trackModel, rowNum int) {
|
|||||||
t.dur.Text = util.SecondsToTimeString(float64(tr.Duration))
|
t.dur.Text = util.SecondsToTimeString(float64(tr.Duration))
|
||||||
t.year.Text = strconv.Itoa(tr.Year)
|
t.year.Text = strconv.Itoa(tr.Year)
|
||||||
t.plays.Text = strconv.Itoa(int(tr.PlayCount))
|
t.plays.Text = strconv.Itoa(int(tr.PlayCount))
|
||||||
|
t.comment.Text = tr.Comment
|
||||||
t.bitrate.Text = strconv.Itoa(tr.BitRate)
|
t.bitrate.Text = strconv.Itoa(tr.BitRate)
|
||||||
t.size.Text = util.BytesToSizeString(tr.Size)
|
t.size.Text = util.BytesToSizeString(tr.Size)
|
||||||
t.path.Text = tr.FilePath
|
t.path.Text = tr.FilePath
|
||||||
@@ -851,6 +860,7 @@ func (t *TrackRow) Update(tm *trackModel, rowNum int) {
|
|||||||
t.rating.IsDisabled = t.tracklist.Options.DisableRating
|
t.rating.IsDisabled = t.tracklist.Options.DisableRating
|
||||||
t.rating.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnRating)]
|
t.rating.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnRating)]
|
||||||
t.plays.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnPlays)]
|
t.plays.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnPlays)]
|
||||||
|
t.comment.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnComment)]
|
||||||
t.bitrate.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnBitrate)]
|
t.bitrate.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnBitrate)]
|
||||||
t.size.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnSize)]
|
t.size.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnSize)]
|
||||||
t.path.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnPath)]
|
t.path.Hidden = !t.tracklist.visibleColumns[ColNumber(ColumnPath)]
|
||||||
|
|||||||
Reference in New Issue
Block a user