Unify scrobbling behavior across subsonic servers. (#2229)

Small change that modifies the `scrobble` controller method to always limit sending a
`scrobble` payload to the subsonic backend to cases where a scrobble is being submitted
or a new song is being started.

This is the current behavior for subsonic backends which support the `reportPlayback` backend
(e.g., Navidrome). This change only modifies the behavior for other backends, which would receive
`scrobble` notifications whenever a song changed for both the stopped song and the newly-started song.

After this change, all subsonic backends now only receive a `scrobble` when a new song is started or
when feishin is attempting to submit a scrobble.
This commit is contained in:
Tristen Allen
2026-07-14 14:46:08 -04:00
committed by GitHub
parent 84fb772b01
commit 8517a9f934
@@ -2213,24 +2213,24 @@ export const SubsonicController: InternalControllerEndpoint = {
scrobble: async (args) => { scrobble: async (args) => {
const { apiClientProps, query } = args; const { apiClientProps, query } = args;
if (hasFeature(apiClientProps.server, ServerFeature.REPORT_PLAYBACK)) { if (query.submission || query.event === 'start') {
if (query.submission || query.event === 'start') { const res = await ssApiClient(apiClientProps).scrobble({
const res = await ssApiClient(apiClientProps).scrobble({ query: {
query: { id: query.id,
id: query.id, submission: query.submission,
submission: query.submission, },
}, });
});
if (res.status !== 200) { if (res.status !== 200) {
throw new Error('Failed to scrobble'); throw new Error('Failed to scrobble');
}
if (query.submission) {
return null;
}
} }
if (query.submission) {
return null;
}
}
if (hasFeature(apiClientProps.server, ServerFeature.REPORT_PLAYBACK)) {
const defaultParams = { const defaultParams = {
ignoreScrobble: true, ignoreScrobble: true,
mediaId: query.id, mediaId: query.id,
@@ -2279,17 +2279,6 @@ export const SubsonicController: InternalControllerEndpoint = {
return null; return null;
} }
const res = await ssApiClient(apiClientProps).scrobble({
query: {
id: query.id,
submission: query.submission,
},
});
if (res.status !== 200) {
throw new Error('Failed to scrobble');
}
return null; return null;
}, },
search: async (args) => { search: async (args) => {