ensure play count in tracklist updates after scrobble
This commit is contained in:
@@ -93,13 +93,14 @@ func (a *AlbumPage) Route() Route {
|
||||
return AlbumRoute(a.albumID)
|
||||
}
|
||||
|
||||
func (a *AlbumPage) OnSongChange(song *subsonic.Child) {
|
||||
func (a *AlbumPage) OnSongChange(song *subsonic.Child, lastScrobbledIfAny *subsonic.Child) {
|
||||
if song == nil {
|
||||
a.nowPlayingID = ""
|
||||
} else {
|
||||
a.nowPlayingID = song.ID
|
||||
}
|
||||
a.tracklist.SetNowPlaying(a.nowPlayingID)
|
||||
a.tracklist.IncrementPlayCount(lastScrobbledIfAny)
|
||||
}
|
||||
|
||||
func (a *AlbumPage) Reload() {
|
||||
|
||||
@@ -36,7 +36,7 @@ type CanSelectAll interface {
|
||||
}
|
||||
|
||||
type CanShowNowPlaying interface {
|
||||
OnSongChange(song *subsonic.Child)
|
||||
OnSongChange(song *subsonic.Child, lastScrobbledIfAny *subsonic.Child)
|
||||
}
|
||||
|
||||
type BrowsingPane struct {
|
||||
@@ -142,7 +142,8 @@ func (b *BrowsingPane) doSetPage(p Page) bool {
|
||||
}
|
||||
b.curPage = p
|
||||
if np, ok := p.(CanShowNowPlaying); ok {
|
||||
np.OnSongChange(b.app.PlaybackManager.NowPlaying())
|
||||
// inform page of currently playing track
|
||||
np.OnSongChange(b.app.PlaybackManager.NowPlaying(), nil)
|
||||
}
|
||||
b.pageContainer.Remove(b.curPage)
|
||||
b.pageContainer.Objects[1] = p
|
||||
@@ -150,12 +151,12 @@ func (b *BrowsingPane) doSetPage(p Page) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) onSongChange(song *subsonic.Child) {
|
||||
func (b *BrowsingPane) onSongChange(song *subsonic.Child, lastScrobbledIfAny *subsonic.Child) {
|
||||
if b.curPage == nil {
|
||||
return
|
||||
}
|
||||
if p, ok := b.curPage.(CanShowNowPlaying); ok {
|
||||
p.OnSongChange(song)
|
||||
p.OnSongChange(song, lastScrobbledIfAny)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,13 +77,14 @@ func (a *NowPlayingPage) SelectAll() {
|
||||
a.tracklist.SelectAll()
|
||||
}
|
||||
|
||||
func (a *NowPlayingPage) OnSongChange(song *subsonic.Child) {
|
||||
func (a *NowPlayingPage) OnSongChange(song *subsonic.Child, lastScrobbledIfAny *subsonic.Child) {
|
||||
if song == nil {
|
||||
a.nowPlayingID = ""
|
||||
} else {
|
||||
a.nowPlayingID = song.ID
|
||||
}
|
||||
a.tracklist.SetNowPlaying(a.nowPlayingID)
|
||||
a.tracklist.IncrementPlayCount(lastScrobbledIfAny)
|
||||
}
|
||||
|
||||
func (a *NowPlayingPage) Reload() {
|
||||
|
||||
@@ -84,13 +84,14 @@ func (a *PlaylistPage) Route() Route {
|
||||
return PlaylistRoute(a.playlistID)
|
||||
}
|
||||
|
||||
func (a *PlaylistPage) OnSongChange(song *subsonic.Child) {
|
||||
func (a *PlaylistPage) OnSongChange(song *subsonic.Child, lastScrobbledIfAny *subsonic.Child) {
|
||||
if song == nil {
|
||||
a.nowPlayingID = ""
|
||||
} else {
|
||||
a.nowPlayingID = song.ID
|
||||
}
|
||||
a.tracklist.SetNowPlaying(a.nowPlayingID)
|
||||
a.tracklist.IncrementPlayCount(lastScrobbledIfAny)
|
||||
}
|
||||
|
||||
func (a *PlaylistPage) Reload() {
|
||||
|
||||
Reference in New Issue
Block a user