Skip to content

🎧 Your Personal Streaming Service

fix(scrobbler): proxy NowPlaying even when ignoreScrobble is set (#5559)

Deluan Quintãobc107d1ceed3
diff --git a/core/scrobbler/play_tracker.go b/core/scrobbler/play_tracker.go
index bdb261ef2..860a80bce 100644
--- a/core/scrobbler/play_tracker.go
+++ b/core/scrobbler/play_tracker.go
@@ -371,7 +371,14 @@ func (p *playTracker) ReportPlayback(ctx context.Context, params ReportPlaybackP
p.broker.SendBroadcastMessage(ctx, &events.NowPlayingCount{Count: p.playMap.Len()})
}
- if !params.IgnoreScrobble && player.ScrobbleEnabled &&
+ // NowPlaying gating, by design distinct from scrobble submission:
+ // - IgnoreScrobble=true -> still send NowPlaying (suppresses only the
+ // scrobble submission/play-count above), mirroring the legacy scrobble
+ // endpoint's submission=false behavior.
+ // - player.ScrobbleEnabled=false -> never send NowPlaying.
+ // External agents here are the active scrobblers (Last.fm, ListenBrainz, and
+ // scrobbler plugins) returned by getActiveScrobblers; see dispatchNowPlaying.
+ if player.ScrobbleEnabled &&
(params.State == StateStarting || params.State == StatePlaying) {
if info, err := p.playMap.Get(clientId); err == nil {
p.enqueueNowPlaying(ctx, clientId, user.ID, &info.MediaFile, int(params.PositionMs/1000))
diff --git a/core/scrobbler/play_tracker_test.go b/core/scrobbler/play_tracker_test.go
index 5383244cd..b5a478c2a 100644
--- a/core/scrobbler/play_tracker_test.go
+++ b/core/scrobbler/play_tracker_test.go
@@ -521,6 +521,7 @@ var _ = Describe("PlayTracker", func() {
})
It("does NOT scrobble when ignoreScrobble=true even if threshold met", func() {
+ fake.ScrobbleCalled.Store(false)
err := tracker.ReportPlayback(ctx, ReportPlaybackParams{
MediaId: "123", PositionMs: 0, State: "starting", PlaybackRate: 1.0, ClientId: defaultClientId,
})
@@ -531,6 +532,7 @@ var _ = Describe("PlayTracker", func() {
})
Expect(err).ToNot(HaveOccurred())
Expect(track.PlayCount).To(Equal(int64(0)))
+ Consistently(func() bool { return fake.ScrobbleCalled.Load() }).Should(BeFalse())
})
It("does NOT scrobble when player ScrobbleEnabled=false even if threshold met", func() {
@@ -715,14 +717,14 @@ var _ = Describe("PlayTracker", func() {
Consistently(func() bool { return fake.GetNowPlayingCalled() }).Should(BeFalse())
})
- It("does NOT dispatch when ignoreScrobble=true", func() {
+ It("still dispatches NowPlaying when ignoreScrobble=true", func() {
fake.nowPlayingCalled.Store(false)
err := tracker.ReportPlayback(ctx, ReportPlaybackParams{
MediaId: "123", PositionMs: 0, State: "starting", PlaybackRate: 1.0, ClientId: defaultClientId,
IgnoreScrobble: true,
})
Expect(err).ToNot(HaveOccurred())
- Consistently(func() bool { return fake.GetNowPlayingCalled() }).Should(BeFalse())
+ Eventually(func() bool { return fake.GetNowPlayingCalled() }).Should(BeTrue())
})
It("does NOT dispatch when ScrobbleEnabled=false", func() {