Initial work: support showing studios for jellyfin, allow pill to be clickable (#1566)

This commit is contained in:
Kendall Garner
2026-01-18 21:53:34 +00:00
committed by GitHub
parent cf428a14a3
commit 5c06624f8c
11 changed files with 228 additions and 315 deletions
@@ -248,6 +248,15 @@ export const contract = c.router({
404: jfType._response.error,
},
},
getStudioList: {
method: 'GET',
path: 'studios',
query: jfType._parameters.studioList,
responses: {
200: jfType._response.studioList,
400: jfType._response.error,
},
},
getTopSongsList: {
method: 'GET',
path: 'users/:userId/items',
@@ -25,6 +25,7 @@ import {
songListSortMap,
SortOrder,
sortOrderMap,
Tag,
} from '/@/shared/types/domain-types';
import { ServerFeature } from '/@/shared/types/features-types';
@@ -1233,12 +1234,38 @@ export const JellyfinController: InternalControllerEndpoint = {
throw new Error('failed to get tags');
}
return {
boolTags: res.body.Tags?.sort((a, b) =>
a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()),
),
excluded: { album: [], song: [] },
};
const studioRes = await jfApiClient(apiClientProps).getStudioList({
query: {
EnableTotalRecordCount: true,
IncludeItemTypes: query.type === LibraryItem.SONG ? 'Audio' : 'MusicAlbum',
ParentId: query.folder,
},
});
if (studioRes.status !== 200) {
throw new Error('failed to get studios');
}
const tags: Tag[] = [];
if (res.body.Tags?.length) {
tags.push({
name: 'Tags',
options: res.body.Tags.sort((a, b) =>
a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()),
).map((tag) => ({ id: tag, name: tag })),
});
}
if (studioRes.body.Items.length) {
tags.push({
name: 'Studios',
options: studioRes.body.Items.sort((a, b) =>
a.Name.toLocaleLowerCase().localeCompare(b.Name.toLocaleLowerCase()),
).map((option) => ({ id: option.Name, name: option.Name })),
});
}
return { excluded: { album: [], song: [] }, tags };
},
getTopSongs: async (args) => {
const { apiClientProps, query } = args;
@@ -778,7 +778,7 @@ export const NavidromeController: InternalControllerEndpoint = {
}
}
const enumTags = Array.from(tagsToValues)
const tags = Array.from(tagsToValues)
.map((data) => ({
name: data[0],
options: data[1]
@@ -793,12 +793,11 @@ export const NavidromeController: InternalControllerEndpoint = {
const excludedSongTags = Array.from(EXCLUDED_SONG_TAGS.values());
return {
boolTags: undefined,
enumTags,
excluded: {
album: excludedAlbumTags,
song: excludedSongTags,
},
tags,
};
},
getTopSongs: SubsonicController.getTopSongs,