Skip to content

Add clarifiaction on result of scrobble#202

Open
cquike wants to merge 1 commit intoopensubsonic:mainfrom
cquike:scrobble_result_clarification
Open

Add clarifiaction on result of scrobble#202
cquike wants to merge 1 commit intoopensubsonic:mainfrom
cquike:scrobble_result_clarification

Conversation

@cquike
Copy link
Copy Markdown
Contributor

@cquike cquike commented Feb 4, 2026

This PR adds the clarification discussed in #201:

  • If any of the id's in the scrobble is invalid the result is error code70.
  • If any of the id's in the scrobble is invalid no scrobbled should be even for the valid id's.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 4, 2026

Deploy Preview for opensubsonic ready!

Name Link
🔨 Latest commit f677b86
🔍 Latest deploy log https://app.netlify.com/projects/opensubsonic/deploys/6984b334a124680008af34f1
😎 Deploy Preview https://deploy-preview-202--opensubsonic.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

deluan added a commit to navidrome/navidrome that referenced this pull request Feb 4, 2026
Implements OpenSubsonic API clarification from PR #202: the scrobble
endpoint now validates all media file IDs before processing and returns
error code 70 (data not found) if any ID is invalid. This ensures the
entire operation fails atomically - no scrobbles are submitted when any
ID in the batch is invalid, matching the OpenSubsonic specification.

Changes include updating MediaFileRepository.Exists() to accept variadic
IDs for efficient batch validation via a single COUNT query.

See: opensubsonic/open-subsonic-api#202
Signed-off-by: Deluan <deluan@navidrome.org>
@Tolriq
Copy link
Copy Markdown
Member

Tolriq commented Feb 5, 2026

Unfortunately that's not how it works :) We can't just clarify things if all the servers are not on page else the docs says X and the servers do Y and this breaks the purpose of OpenSubsonic.

If you can get all subsonic servers onboard to actually do that before merging this then why not.
Else it's best to write it as the server should do that with a note that the client should check actual implementation.

@deluan
Copy link
Copy Markdown
Member

deluan commented Feb 5, 2026

I'm onboard with it (Navidrome). That totally make sense, even though I'm not doing it atm. Just waiting for this to be approved to merge the fix: navidrome/navidrome#4984

EDIT: As pointed out below, I actually think that processing the valid scrobbles, and silently ignoring the failing ones is a simpler and better approach.

@cquike cquike force-pushed the scrobble_result_clarification branch from 39330c1 to f677b86 Compare February 5, 2026 15:11
@paulijar
Copy link
Copy Markdown
Member

paulijar commented Feb 5, 2026

I'm willing to update Nextcloud Music to follow this specification.

@deluan deluan requested a review from a team February 6, 2026 12:23
@epoupon
Copy link
Copy Markdown
Member

epoupon commented Feb 6, 2026

From the point of view of a client who has stored offline dozens of scrobbles.
Does that mean that if a track has been removed, they won’t be able to submit anything?
So this would end up forcing clients to always submit scrobbles one by one? (in reality the client probably doesn’t care much about knowing that the track is no longer there, it’s more of a best-effort thing)

@Tolriq
Copy link
Copy Markdown
Member

Tolriq commented Feb 6, 2026

In my case I always send 1 by 1 to be sure the data is properly synced when back online, and rely on the error 70 to stop trying as I know the track is no more on the server and not a temporary issue that I'll retry later.

@deluan
Copy link
Copy Markdown
Member

deluan commented Feb 6, 2026

So this would end up forcing clients to always submit scrobbles one by one?

I think this is up to the client to decide. If I was implementing it, I'd do:

  • Try to send the batch first, if it returns success, great!
  • If not success, fallback to sending it one by one, skip/log/notify the ones that resulted in error

Thinking more about this, maybe the simpler implementation of always return success make sense: If the client is well implemented, this should only happen when the music file is gone, and in that case any errors could be safely ignored.

@MichaelBechHansen
Copy link
Copy Markdown
Member

play:Sub chiming in here:
This seems like a case that will only happen when the media is gone from the server,
which means there is not much that can be done to remedy anything.

Failing otherwise good scrobbles and requiring a fallback to scrobbling 1 by 1 will mean more complex/errorprone implementation with little gains to show for it.

I'm in the pragmatic camp here, and believe that succeeding the scrobbles that are ok, while silently failing the others are the way to go in this case.

@MichaelBechHansen
Copy link
Copy Markdown
Member

MichaelBechHansen commented Feb 6, 2026

Maybe the clarification should be along the lines of:

  • individual scrobble requests may fail with error 70 when media is no longer available
  • multi-scrobble requests will succeed when at least one scrobble is accepted at the server.
  • Servers will only fail a multi-scrobble request when all scrobbles are failed.

@paulijar
Copy link
Copy Markdown
Member

paulijar commented Feb 6, 2026

Maybe the clarification should be along the lines of:

  • individual scrobble requests may fail with error 70 when media is no longer available
  • multi-scrobble requests will succeed when at least one scrobble is accepted at the server.
  • Servers will only fail a multi-scrobble request when all scrobbles are failed.

If going down this road, I would rather just specify

  • the request will fail with 70 if all the given id values are invalid
  • the request will succeed if there is one or more valid id values; any invalid values get silently ignored

There's really no reason to separate the single/multi cases here because the single-id is just a one-item-list and already sufficiently handled by the generic rules.

@lachlan-00
Copy link
Copy Markdown
Member

Maybe the clarification should be along the lines of:

  • individual scrobble requests may fail with error 70 when media is no longer available
  • multi-scrobble requests will succeed when at least one scrobble is accepted at the server.
  • Servers will only fail a multi-scrobble request when all scrobbles are failed.

If going down this road, I would rather just specify

* the request will fail with 70 if all the given `id` values are invalid

* the request will succeed if there is one or more valid `id` values; any invalid values get silently ignored

There's really no reason to separate the single/multi cases here because the single-id is just a one-item-list and already sufficiently handled by the generic rules.

This is the way i would do it. right now i ignore missing items entirely so it's always successful which is a throwback to last.fm using title, artist, album for submission. technically it was submitted successfully, just didn't find anything.

Most submissions will be singles and this is submitted by ID so a fail on all submitted would be the way.

There are a few things like this in the API that have a subsonic way that i'm not always aware of so this is a good thing to do.

{{< /tab >}}
{{< /tabpane >}}

If any `id` is invalid the result is an empty [`subsonic-response`](../../responses/subsonic-response) with error code 70 "The requested data was not found". Note that in this case the whole request has failed and no scrobbling should be performed for those `id` which are valid.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"If all id values are invalid" and you would get this pull through

@kgarner7
Copy link
Copy Markdown
Contributor

Hi there, what is happening with this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants