Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TvShowsApiGetEpisodesRequest type for getEpisodes query parameters #644

Merged
merged 5 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
MediaSourceInfo,
BaseItemDto,
BaseItemPerson,
TvShowsApiGetEpisodesRequest,
UserDto
} from '@jellyfin/sdk/lib/generated-client';
import { JellyfinApi } from './components/jellyfinApi';
Expand Down Expand Up @@ -590,23 +591,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 @@ -704,15 +699,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
Loading