Compilation support for Jellyfin artist albums, misc other album filter fixes

- Jellyfin will use `ContributingArtistsId` (compilation), `AlbumArtistIds` (compilation is false), or `ArtistIds` (unspecified; all)
- Jellyfin can filter by compilation _only_ on the artist discography page
- Navidrome album filter fix for `defaultValue` display and prevent showing `tagQuery` 0 when querying
- Subsonic can filter by one or more artists in the album page. Sort is also applied on these items
- Bump genre/tag cache/stale time to 2/1 minutes
- Fix various cases where the album filter would display as active when it wasn't
This commit is contained in:
Kendall Garner 2025-07-02 07:44:57 -07:00
parent 6f5dd4881a
commit 176a95a946
No known key found for this signature in database
GPG key ID: 9355F387FE765C94
7 changed files with 167 additions and 47 deletions

View file

@ -290,19 +290,32 @@ export const JellyfinController: ControllerEndpoint = {
const yearsFilter = yearsGroup.length ? yearsGroup.join(',') : undefined;
let artistQuery:
| Omit<z.infer<typeof jfType._parameters.albumList>, 'IncludeItemTypes'>
| undefined;
if (query.artistIds) {
// Based mostly off of observation, this is the behavior I've seen:
// ContributingArtistIds is the _closest_ to where the album is a compilation and the artist is involved
// AlbumArtistIds is where the artist is an album artist
// ArtistIds is all credits
if (query.compilation) {
artistQuery = {
ContributingArtistIds: formatCommaDelimitedString(query.artistIds),
};
} else if (query.compilation === false) {
artistQuery = { AlbumArtistIds: formatCommaDelimitedString(query.artistIds) };
} else {
artistQuery = { ArtistIds: formatCommaDelimitedString(query.artistIds) };
}
}
const res = await jfApiClient(apiClientProps).getAlbumList({
params: {
userId: apiClientProps.server?.userId,
},
query: {
...(!query.compilation &&
query.artistIds && {
AlbumArtistIds: formatCommaDelimitedString(query.artistIds),
}),
...(query.compilation &&
query.artistIds && {
ContributingArtistIds: query.artistIds[0],
}),
...artistQuery,
Fields: 'People, Tags',
GenreIds: query.genres ? query.genres.join(',') : undefined,
IncludeItemTypes: 'MusicAlbum',

View file

@ -316,8 +316,10 @@ export const SubsonicController: ControllerEndpoint = {
return artist.body.artist.album ?? [];
});
const items = albums.map((album) => ssNormalize.album(album, apiClientProps.server));
return {
items: albums.map((album) => ssNormalize.album(album, apiClientProps.server)),
items: sortAlbumList(items, query.sortBy, query.sortOrder),
startIndex: 0,
totalRecordCount: albums.length,
};