mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
more jellyfin api fixes
This commit is contained in:
@@ -206,9 +206,9 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
const res = await jfApiClient(apiClientProps).getAlbumArtistList({
|
||||
query: {
|
||||
Fields: 'Genres, DateCreated, ExternalUrls, Overview',
|
||||
FolderId: getLibraryId(query.musicFolderId),
|
||||
ImageTypeLimit: 1,
|
||||
Limit: query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
Recursive: true,
|
||||
SearchTerm: query.searchTerm,
|
||||
SortBy: albumArtistListSortMap.jellyfin[query.sortBy] || 'SortName,Name',
|
||||
@@ -316,11 +316,11 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
...artistQuery,
|
||||
Fields: 'People, Tags',
|
||||
FolderId: getLibraryId(query.musicFolderId),
|
||||
GenreIds: query.genreIds ? query.genreIds.join(',') : undefined,
|
||||
IncludeItemTypes: 'MusicAlbum',
|
||||
IsFavorite: query.favorite,
|
||||
Limit: query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
Recursive: true,
|
||||
SearchTerm: query.searchTerm,
|
||||
SortBy: albumListSortMap.jellyfin[query.sortBy] || 'SortName',
|
||||
@@ -352,9 +352,9 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
const res = await jfApiClient(apiClientProps).getArtistList({
|
||||
query: {
|
||||
Fields: 'Genres, DateCreated, ExternalUrls, Overview',
|
||||
FolderId: getLibraryId(query.musicFolderId),
|
||||
ImageTypeLimit: 1,
|
||||
Limit: query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
Recursive: true,
|
||||
SearchTerm: query.searchTerm,
|
||||
SortBy: albumArtistListSortMap.jellyfin[query.sortBy] || 'SortName,Name',
|
||||
@@ -397,8 +397,8 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
EnableTotalRecordCount: true,
|
||||
Fields: 'ItemCounts',
|
||||
FolderId: getLibraryId(query.musicFolderId),
|
||||
Limit: query.limit === -1 ? undefined : query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
Recursive: true,
|
||||
SearchTerm: query?.searchTerm,
|
||||
SortBy: genreListSortMap.jellyfin[query.sortBy] || 'SortName',
|
||||
@@ -579,6 +579,7 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
},
|
||||
query: {
|
||||
Fields: 'Genres, DateCreated, MediaSources, ParentId, People, Tags',
|
||||
FolderId: getLibraryId(query.musicFolderId),
|
||||
GenreIds: query.genre ? query.genre : undefined,
|
||||
IncludeItemTypes: 'Audio',
|
||||
IsPlayed:
|
||||
@@ -588,7 +589,6 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
? true
|
||||
: undefined,
|
||||
Limit: query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
Recursive: true,
|
||||
SortBy: JFSongListSort.RANDOM,
|
||||
SortOrder: JFSortOrder.ASC,
|
||||
@@ -738,11 +738,11 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
AlbumIds: albumIdsFilter,
|
||||
ArtistIds: artistIdsFilter,
|
||||
Fields: 'Genres, DateCreated, MediaSources, ParentId, People, Tags',
|
||||
FolderId: getLibraryId(query.musicFolderId),
|
||||
GenreIds: query.genreIds?.join(','),
|
||||
IncludeItemTypes: 'Audio',
|
||||
IsFavorite: query.favorite,
|
||||
Limit: query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
Recursive: true,
|
||||
SearchTerm: query.searchTerm,
|
||||
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
|
||||
@@ -765,19 +765,19 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
? formatCommaDelimitedString(query.albumIds)
|
||||
: undefined;
|
||||
|
||||
const parentIdFilter = [albumIdsFilter, artistIdsFilter].filter(Boolean).join(',');
|
||||
|
||||
const res = await jfApiClient(apiClientProps).getSongList({
|
||||
params: {
|
||||
userId: apiClientProps.server?.userId,
|
||||
},
|
||||
query: {
|
||||
AlbumIds: albumIdsFilter,
|
||||
ArtistIds: artistIdsFilter,
|
||||
Fields: 'Genres, DateCreated, MediaSources, ParentId, People, Tags',
|
||||
GenreIds: query.genreIds?.join(','),
|
||||
IncludeItemTypes: 'Audio',
|
||||
IsFavorite: query.favorite,
|
||||
Limit: query.limit,
|
||||
ParentId: getMusicFolderId(query.musicFolderId),
|
||||
ParentId: parentIdFilter,
|
||||
Recursive: true,
|
||||
SearchTerm: query.searchTerm,
|
||||
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
|
||||
@@ -1161,6 +1161,6 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
// };
|
||||
// };
|
||||
|
||||
function getMusicFolderId(musicFolderId?: string | string[]) {
|
||||
function getLibraryId(musicFolderId?: string | string[]) {
|
||||
return Array.isArray(musicFolderId) ? musicFolderId[0] : musicFolderId;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
|
||||
const res = await ssApiClient(apiClientProps).getArtists({
|
||||
query: {
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -338,7 +338,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
if (query.favorite) {
|
||||
const res = await ssApiClient(apiClientProps).getStarred({
|
||||
query: {
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -396,7 +396,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
fromYear,
|
||||
genre: query.genreIds?.length ? query.genreIds[0] : undefined,
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
offset: query.startIndex,
|
||||
size: query.limit,
|
||||
toYear,
|
||||
@@ -483,7 +483,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
if (query.favorite) {
|
||||
const res = await ssApiClient(apiClientProps).getStarred({
|
||||
query: {
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -529,7 +529,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
fromYear,
|
||||
genre: query.genreIds?.length ? query.genreIds[0] : undefined,
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
offset: startIndex,
|
||||
size: MAX_SUBSONIC_ITEMS,
|
||||
toYear,
|
||||
@@ -565,7 +565,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
|
||||
const res = await ssApiClient(apiClientProps).getArtists({
|
||||
query: {
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -781,7 +781,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
fromYear: query.minYear,
|
||||
genre: query.genre,
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
size: query.limit,
|
||||
toYear: query.maxYear,
|
||||
},
|
||||
@@ -936,7 +936,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
count: query.limit,
|
||||
genre: query.genreIds[0],
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
offset: query.startIndex,
|
||||
},
|
||||
});
|
||||
@@ -957,7 +957,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
if (query.favorite) {
|
||||
const res = await ssApiClient(apiClientProps).getStarred({
|
||||
query: {
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1125,7 +1125,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
count: 1,
|
||||
genre: query.genreIds[0],
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
offset: sectionIndex,
|
||||
},
|
||||
});
|
||||
@@ -1150,7 +1150,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
count: MAX_SUBSONIC_ITEMS,
|
||||
genre: query.genreIds[0],
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
offset: startIndex,
|
||||
},
|
||||
});
|
||||
@@ -1173,7 +1173,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
if (query.favorite) {
|
||||
const res = await ssApiClient(apiClientProps).getStarred({
|
||||
query: {
|
||||
musicFolderId: getMusicFolderId(query.musicFolderId),
|
||||
musicFolderId: getLibraryId(query.musicFolderId),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1422,6 +1422,6 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
},
|
||||
};
|
||||
|
||||
function getMusicFolderId(musicFolderId?: string | string[]) {
|
||||
function getLibraryId(musicFolderId?: string | string[]) {
|
||||
return Array.isArray(musicFolderId) ? musicFolderId[0] : musicFolderId;
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ const baseParameters = z.object({
|
||||
ExcludeItemIds: z.string().optional(),
|
||||
ExcludeItemTypes: z.string().optional(),
|
||||
Fields: z.string().optional(),
|
||||
FolderId: z.string().optional(),
|
||||
ImageTypeLimit: z.number().optional(),
|
||||
IncludeArtists: z.boolean().optional(),
|
||||
IncludeGenres: z.boolean().optional(),
|
||||
|
||||
Reference in New Issue
Block a user