Fix #741: add album year to now playing

This commit is contained in:
zacaj
2025-11-23 19:14:40 +00:00
parent a884795a78
commit 9fdb62ab56
9 changed files with 59 additions and 31 deletions
+7 -3
View File
@@ -79,6 +79,7 @@ type nowPlayingPageState struct {
mp mediaprovider.MediaProvider
canRate bool
canShare bool
cfg *backend.Config
}
func NewNowPlayingPage(
@@ -92,9 +93,10 @@ func NewNowPlayingPage(
mp mediaprovider.MediaProvider,
canRate bool,
canShare bool,
cfg *backend.Config,
) *NowPlayingPage {
state := nowPlayingPageState{
conf: conf, contr: contr, pool: pool, sm: sm, lm: lm, im: im, pm: pm, mp: mp, canRate: canRate, canShare: canShare,
conf: conf, contr: contr, pool: pool, sm: sm, lm: lm, im: im, pm: pm, mp: mp, canRate: canRate, canShare: canShare, cfg: cfg,
}
if page, ok := pool.Obtain(util.WidgetTypeNowPlayingPage).(*NowPlayingPage); ok && page != nil {
page.nowPlayingPageState = state
@@ -109,7 +111,7 @@ func NewNowPlayingPage(
pm.OnPlaying(doFmtStatus)
pm.OnStopped(doFmtStatus)
a.card = widgets.NewLargeNowPlayingCard()
a.card = widgets.NewLargeNowPlayingCard(cfg)
a.card.OnAlbumNameTapped = func() {
contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID))
}
@@ -474,7 +476,7 @@ func (a *NowPlayingPage) Reload() {
}
func (s *nowPlayingPageState) Restore() Page {
return NewNowPlayingPage(s.conf, s.contr, s.pool, s.sm, s.lm, s.im, s.pm, s.mp, s.canRate, s.canShare)
return NewNowPlayingPage(s.conf, s.contr, s.pool, s.sm, s.lm, s.im, s.pm, s.mp, s.canRate, s.canShare, s.cfg)
}
var _ CanShowPlayTime = (*NowPlayingPage)(nil)
@@ -527,6 +529,8 @@ func (a *NowPlayingPage) Refresh() {
}
}
a.BaseWidget.Refresh()
a.card.Update(a.nowPlaying)
}
func (a *NowPlayingPage) saveSelectedTab(tabNum int) {