Add artistRoleFilter extension#256
Conversation
✅ Deploy Preview for opensubsonic ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
artistRoleFilter extension
| | Parameter | Req. | OpenS. | Default | Comment | | ||
| | --- | --- | --- | --- | --- | | ||
| | `musicFolderId` | No | | | If specified, only return artists in the music folder with the given ID. See [`getMusicFolders`](../getmusicfolders). | | ||
| | `roles` | No | No / **Yes** | | A comma-separated list of roles used to filter the returned artists. Requires the [`Artist role filter`](../../extensions/artistRoleFilter/) extension. | |
There was a problem hiding this comment.
You probably intended to have the "No / Yes" in the Req. column, not in the OpenS. column? But even there, it would probably be more correct to simply define it as "No"; the client is always allowed omit the parameter and the server should not emit an error in that case. The alert box below is IMO sufficient to indicate that the servers implementing the extension must accept the parameter.
There was a problem hiding this comment.
In the stream.md, that does make sense because the timeOffset exists already in OG Subsonic but OS extends it to be applicable on streams other than videos.
|
To add to the table of current behavior, Nextcloud Music nowadays returns album artists only for |
|
We need the new endpoints that handle all this and solve that. I'll tackle that after the holidays. |
kgarner7
left a comment
There was a problem hiding this comment.
I think a safer approach than comma-separated list is just repeated artistRoles=&artistRoles= (or, make it singular to save a few bytes)
One other note. artistRoles would probably also be very useful for getArtist, to specify which albums are returned for an artist. At least in Navidrome, it only returns albums where the artist is credited as an album artist (default) or artist (can be enabled). Having the role filter there will allow for fetching other album credits for this artist.
Lastly, it might be useful to have a global getAvailableRoles or similar, so a client could know which roles are available period (or, even add a per-library filter for that).
Thanks for starting this!
| | `songCount` | No | | 20 | Maximum number of songs to return. | | ||
| | `songOffset` | No | | 0 | Search result offset for songs. Used for paging. | | ||
| | `musicFolderId` | No | | | (Since [1.12.0](../../subsonic-versions)) Only return results from music folder with the given ID. See `getMusicFolders`. | | ||
| | `artistRoles` | No | No / **Yes** | | A comma-separated list of roles used to filter the returned artists. Requires the [`Artist role filter`](../../extensions/artistRoleFilter/) extension. | |
There was a problem hiding this comment.
Same here, this should probably be Req: No, OpenS: Yes.
Also, it shouldn't be No / Yes, that means that the client is required to send it.
|
|
||
| If the server supports the [`Artist role filter`](../../extensions/artistRoleFilter/) extension, it **must** accept the `artistRoles` parameter and filter the returned **artists** accordingly (albums and songs are unaffected). | ||
|
|
||
| `artistRoles` is a comma-separated list of roles as found in the [`ArtistID3`](../../responses/artistid3) `roles` field (e.g. `albumartist`, `artist`, `composer`). An artist is returned if it has **any** of the requested roles. The special value `all` returns every artist regardless of role. The behavior when `artistRoles` is **not** provided is left to the server (historically, returning only album artists), so that existing clients are unaffected. |
There was a problem hiding this comment.
Comma-separated is potentially risky (or messy) in the event one of your roles has a comma. Why not do repeated id? e.g. artistRoles=a&artistRoles=b?
There was a problem hiding this comment.
We need new endpoints to handle both getartists and search3, filters, sorting and telling what fields we want. Done via proper json and post as the transcoding endpoints.
This solves all the issues for all the cases and all the clients.
Yeah, I think multiple
👍🏼
👍🏼 |
|
@kgarner7 @paulijar thanks! made the param singular, repeated param, and fixed the table docs
@Tolriq oh I don't have much context on new endpoints. could be nice I suppose (though I'm not sure what problem they would solve yet) but do you think it needs to block this? the extension is quite small (a one-line filter server-side, an extra param client-side), just additive, and unblocks what we have today: Symfonium syncing with |
|
Yes it needs to block, because it's a breaking change. It force LMS to change it's behavior and the search3 change is breaking, if the server have the extension then it must respect it and so not passing the param should not return all artists that's breaking. Else the absence of the value despite the extension leaves the result unknown and that's against the principles of OS. Accepting this now and having seach3 respecting the field would mean Symfonium being broken until it support this so a couple of month due to holidays ;) Furthermore this just solve one filtering need, but there's a lot more filtering needs, so do we add an extension for each filters? What about sorting ? And what about only returning the fields that a client need to improve OS. This was discussed quite a couple of times already about the need and the scope of the new endpoints that solve all this. No more need for search3 and getArtists hacks and limited API a proper getLibraryArtist supporting all the needs. I'll put a quick PR to again explain this and show some more concrete examples. |
Fair on scope - if we want sorting and field selection too, then yeah a proper query endpoint beats a pile of per-filter extensions. so I'll leave this one to you guys 👍 One correction though: this doesn't actually force LMS to change or break anything. no param just means whatever the server does today (LMS based on setting, gonic returns album artists), so it's purely additive. you only get a deterministic result when you opt in and pass the param. getArtists/search3 are already inconsistent across servers. this adds a deterministic path, it doesn't remove one |
That's what I understand as well. Maybe making this point clear in the docs? I'd approve this now, and it would be superseded/eclipsed by the sorting/filtering extension, whenever that is added. |
|
We are trying to build a proper long term API, not add tons of small hacks leading to a worse API then before with clients having to jungle between different ways to do things and having to support all the different cases because server can implement just a part of it. Everything added is not temporary it's a burden for servers and clients for LIFE. |


getArtists(and the artist results ofsearch3) historically return album artists only. This is the original Subsonic behavior, and legacy clients like DSub depend on it: if a server started returning track-level artists, those clients would be flooded with thousands of artists users don't care about - featured/track artists and composers dragged in from compilation albums, soundtracks, etc.At the same time, modern OpenSubsonic clients need the opposite. A client that mirrors/syncs the whole library (e.g. Symfonium, which bulk-fetches artists via
search3with an empty query), or one that lets users browse by composer or track artist, wants all artists.Today there's no way for a client to say which it wants - the behavior is server-defined and inconsistent across implementations:
getArtistsreturnsProposal
A new optional OpenSubsonic extension,
artistRoleFilter, that lets the client choose, via a role filter:getArtists: newrolesparametersearch3: newartistRolesparameter (named to disambiguate from that endpoint's album/song results)The value is a comma-separated list of roles matching the existing
ArtistID3.rolesvocabulary (albumartist,artist,composer, ...). An artist is returned if it has any of the requested roles. The special valueallreturns every artist regardless of role (roles are open-ended - performer, arranger, producer, subroles - so clients wanting "everyone" shouldn't have to enumerate them).The behavior when the parameter is omitted is deliberately left to the server (historically, album artists only). This means:
roles=albumartistorroles=allexplicitly.