Better stringification of play times longer than 1 hr

This commit is contained in:
Drew Weymouth
2024-06-13 18:28:38 -07:00
parent 768c3851ea
commit 169b914abf
6 changed files with 71 additions and 10 deletions
+5 -5
View File
@@ -115,15 +115,15 @@ func NewPlayerControls() *PlayerControls {
pc.slider = NewTrackPosSlider()
pc.slider.Disable()
pc.curTimeLabel = NewLabelMinSize(util.SecondsToTimeString(0), 55)
pc.curTimeLabel = NewLabelMinSize(util.SecondsToMMSS(0), 55)
pc.curTimeLabel.Alignment = fyne.TextAlignTrailing
pc.totalTimeLabel = NewLabelMinSize(util.SecondsToTimeString(0), 55)
pc.totalTimeLabel = NewLabelMinSize(util.SecondsToMMSS(0), 55)
pc.totalTimeLabel.Alignment = fyne.TextAlignTrailing
pc.slider.OnChanged = func(f float64) {
if pc.slider.IsDragging() {
time := f * pc.totalTime
pc.curTimeLabel.SetText(util.SecondsToTimeString(time))
pc.curTimeLabel.SetText(util.SecondsToMMSS(time))
}
}
@@ -178,7 +178,7 @@ func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) {
}
updated := false
tt := util.SecondsToTimeString(totalTime)
tt := util.SecondsToMMSS(totalTime)
if tt != pc.totalTimeLabel.Text {
pc.totalTimeLabel.SetText(tt)
updated = true
@@ -189,7 +189,7 @@ func (pc *PlayerControls) UpdatePlayTime(curTime, totalTime float64) {
pc.slider.Disable()
}
if !pc.slider.IsDragging() {
ct := util.SecondsToTimeString(curTime)
ct := util.SecondsToMMSS(curTime)
if ct != pc.curTimeLabel.Text {
pc.curTimeLabel.SetText(ct)
updated = true
+1 -1
View File
@@ -475,7 +475,7 @@ func (p *PlayQueueListRow) Update(tm *util.TrackListModel, rowNum int) {
p.trackID = meta.ID
p.title.Text = meta.Name
p.artist.BuildSegments(meta.Artists, meta.ArtistIDs)
p.time.Text = util.SecondsToTimeString(float64(meta.Duration))
p.time.Text = util.SecondsToMMSS(float64(meta.Duration))
changed = true
}
+1 -1
View File
@@ -266,7 +266,7 @@ func (t *tracklistRowBase) Update(tm *util.TrackListModel, rowNum int) {
t.name.Segments[0].(*widget.TextSegment).Text = tr.Title
t.artist.BuildSegments(tr.ArtistNames, tr.ArtistIDs)
t.album.BuildSegments([]string{tr.Album}, []string{tr.AlbumID})
t.dur.Text = util.SecondsToTimeString(float64(tr.Duration))
t.dur.Text = util.SecondsToMMSS(float64(tr.Duration))
t.year.Text = strconv.Itoa(tr.Year)
t.plays.Text = strconv.Itoa(int(tr.PlayCount))
t.comment.Text = tr.Comment