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