incremental waveform generation (kind-of) working
This commit is contained in:
@@ -404,7 +404,7 @@ func formatMiscLabelStr(a *mediaprovider.AlbumWithTracks) string {
|
||||
if y := a.ReissueDate.Year; y != nil && *y > a.YearOrZero() {
|
||||
yearStr += fmt.Sprintf(" (%s %s)", lang.L("reissued"), util.FormatItemDate(a.ReissueDate))
|
||||
}
|
||||
return fmt.Sprintf("%s · %s · %s%s", yearStr, tracksMsg, discs, util.SecondsToTimeString(float64(a.Duration)))
|
||||
return fmt.Sprintf("%s · %s · %s%s", yearStr, tracksMsg, discs, util.SecondsToTimeString(a.Duration.Seconds()))
|
||||
}
|
||||
|
||||
func (s *albumPageState) Restore() Page {
|
||||
|
||||
@@ -375,7 +375,7 @@ func (a *NowPlayingPage) fetchLyrics(ctx context.Context, song *mediaprovider.Tr
|
||||
}
|
||||
}
|
||||
if lyrics == nil && a.lrcFetch != nil {
|
||||
lyrics, err = a.lrcFetch.FetchLrcLibLyrics(song.Title, song.ArtistNames[0], song.Album, song.Duration)
|
||||
lyrics, err = a.lrcFetch.FetchLrcLibLyrics(song.Title, song.ArtistNames[0], song.Album, int(song.Duration.Seconds()))
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
}
|
||||
@@ -445,7 +445,7 @@ func (a *NowPlayingPage) Reload() {
|
||||
a.queueList.SetItems(a.queue)
|
||||
a.totalTime = 0.0
|
||||
for _, tr := range a.queue {
|
||||
a.totalTime += float64(tr.Metadata().Duration)
|
||||
a.totalTime += tr.Metadata().Duration.Seconds()
|
||||
}
|
||||
a.formatStatusLine()
|
||||
|
||||
@@ -546,7 +546,7 @@ func (a *NowPlayingPage) formatStatusLine() {
|
||||
|
||||
dur := 0.0
|
||||
if np := a.pm.NowPlaying(); np != nil {
|
||||
dur = float64(np.Metadata().Duration)
|
||||
dur = np.Metadata().Duration.Seconds()
|
||||
}
|
||||
statusSuffix := ""
|
||||
trackNum := 0
|
||||
|
||||
@@ -514,7 +514,7 @@ func (a *PlaylistPageHeader) formatPlaylistTrackTimeStr(p *mediaprovider.Playlis
|
||||
fallbackTracksMsg := fmt.Sprintf("%d %s", p.TrackCount, tracks)
|
||||
tracksMsg := lang.LocalizePluralKey("{{.trackCount}} tracks",
|
||||
fallbackTracksMsg, p.TrackCount, map[string]string{"trackCount": strconv.Itoa(p.TrackCount)})
|
||||
return fmt.Sprintf("%s, %s", tracksMsg, util.SecondsToTimeString(float64(p.Duration)))
|
||||
return fmt.Sprintf("%s, %s", tracksMsg, util.SecondsToTimeString(p.Duration.Seconds()))
|
||||
}
|
||||
|
||||
func (s *playlistPageState) Restore() Page {
|
||||
|
||||
@@ -82,7 +82,7 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer {
|
||||
c.Add(genres)
|
||||
}
|
||||
|
||||
addFormRow(c, lang.L("Duration"), util.SecondsToTimeString(float64(t.track.Duration)))
|
||||
addFormRow(c, lang.L("Duration"), util.SecondsToTimeString(t.track.Duration.Seconds()))
|
||||
addFormRow(c, lang.L("Comment"), t.track.Comment)
|
||||
addFormRow(c, lang.L("Year"), strconv.Itoa(t.track.Year))
|
||||
addFormRow(c, lang.L("Track number"), strconv.Itoa(t.track.TrackNumber))
|
||||
|
||||
@@ -453,7 +453,7 @@ func (p *PlayQueueListRow) Update(tm *util.TrackListModel, rowNum int) {
|
||||
p.title.Text = meta.Name
|
||||
p.title.SetToolTip(meta.Name)
|
||||
p.artist.BuildSegments(meta.Artists, meta.ArtistIDs)
|
||||
p.time.Text = util.SecondsToMMSS(float64(meta.Duration))
|
||||
p.time.Text = util.SecondsToMMSS(meta.Duration.Seconds())
|
||||
}
|
||||
|
||||
// Render whether track is playing or not
|
||||
|
||||
@@ -439,7 +439,7 @@ func (t *Tracklist) doSortTracks() {
|
||||
case ColumnRating:
|
||||
t.intSort(func(tr *util.TrackListModel) int64 { return int64(tr.Track().Rating) })
|
||||
case ColumnTime:
|
||||
t.intSort(func(tr *util.TrackListModel) int64 { return int64(tr.Track().Duration) })
|
||||
t.intSort(func(tr *util.TrackListModel) int64 { return tr.Track().Duration.Milliseconds() })
|
||||
case ColumnYear:
|
||||
t.intSort(func(tr *util.TrackListModel) int64 { return int64(tr.Track().Year) })
|
||||
case ColumnSize:
|
||||
|
||||
@@ -401,7 +401,7 @@ func (t *tracklistRowBase) doUpdate(tm *util.TrackListModel, rowNum int) {
|
||||
t.artist.BuildSegments(tr.ArtistNames, tr.ArtistIDs)
|
||||
t.album.BuildSegments([]string{tr.Album}, []string{tr.AlbumID})
|
||||
t.composer.BuildSegments(tr.ComposerNames, tr.ComposerIDs)
|
||||
t.dur.Text = util.SecondsToMMSS(float64(tr.Duration))
|
||||
t.dur.Text = util.SecondsToMMSS(tr.Duration.Seconds())
|
||||
t.year.Text = strconv.Itoa(tr.Year)
|
||||
t.plays.Text = strconv.Itoa(int(tr.PlayCount))
|
||||
t.comment.Text = strings.ReplaceAll(tr.Comment, "\n", " ")
|
||||
|
||||
Reference in New Issue
Block a user