Skip to content

Commit

Permalink
Merge pull request #644 from 3flex/get-episodes
Browse files Browse the repository at this point in the history
Use TvShowsApiGetEpisodesRequest type for getEpisodes query parameters
  • Loading branch information
nielsvanvelzen authored Oct 25, 2024
2 parents c004df6 + 4b80d0b commit ddbb245
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
MediaStream,
BaseItemDto,
BaseItemPerson,
TvShowsApiGetEpisodesRequest,
UserDto
} from '@jellyfin/sdk/lib/generated-client';
import { JellyfinApi } from './components/jellyfinApi';
Expand Down Expand Up @@ -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<BaseItemDtoQueryResult> {
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'
});
}
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ddbb245

Please sign in to comment.