diff --git a/src/helpers.ts b/src/helpers.ts index 4f420766..04a13eb1 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -5,6 +5,7 @@ import type { MediaStream, BaseItemDto, BaseItemPerson, + TvShowsApiGetEpisodesRequest, UserDto } from '@jellyfin/sdk/lib/generated-client'; import { JellyfinApi } from './components/jellyfinApi'; @@ -587,23 +588,17 @@ export async function getItemsForPlayback( /** * Get episodes for a show given by seriesId - * @param userId - userid to use * @param seriesId - series to look up * @param query - query parameters to build on * @returns episode items */ export function getEpisodesForPlayback( - userId: string, seriesId: string, - query: ItemQuery = {} + query: TvShowsApiGetEpisodesRequest ): Promise { - query.UserId = userId; - query.Fields = requiredItemFields; - query.ExcludeLocationTypes = 'Virtual'; - return JellyfinApi.authAjax(`Shows/${seriesId}/Episodes`, { dataType: 'json', - query: query, + query: { ...query, fields: requiredItemFields }, type: 'GET' }); } @@ -701,15 +696,11 @@ export async function translateRequestedItems( return result; } - const episodesResult = await getEpisodesForPlayback( - userId, - episode.SeriesId, - { - IsMissing: false, - IsVirtualUnaired: false, - UserId: userId - } - ); + const episodesResult = await getEpisodesForPlayback(episode.SeriesId, { + isMissing: false, + seriesId: episode.SeriesId, + userId: userId + }); let foundItem = false;