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

Migrate getEpisodesForPlayback to jellyfin-sdk-typescript #687

Merged
merged 1 commit into from
Nov 7, 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
17 changes: 8 additions & 9 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
TvShowsApiGetEpisodesRequest,
UserDto
} from '@jellyfin/sdk/lib/generated-client';
import { getTvShowsApi } from '@jellyfin/sdk/lib/utils/api';
import { JellyfinApi } from './components/jellyfinApi';
import { PlaybackManager, PlaybackState } from './components/playbackManager';
import { BusMessage, ItemQuery } from './types/global';
Expand Down Expand Up @@ -580,19 +581,17 @@ export async function getItemsForPlayback(

/**
* Get episodes for a show given by seriesId
* @param seriesId - series to look up
* @param query - query parameters to build on
* @returns episode items
*/
export function getEpisodesForPlayback(
seriesId: string,
export async function getEpisodesForPlayback(
query: TvShowsApiGetEpisodesRequest
): Promise<BaseItemDtoQueryResult> {
return JellyfinApi.authAjax(`Shows/${seriesId}/Episodes`, {
dataType: 'json',
query: { ...query, fields: requiredItemFields },
type: 'GET'
});
const response = await getTvShowsApi(JellyfinApi.jellyfinApi).getEpisodes(
query
);

return response.data;
}

/**
Expand Down Expand Up @@ -688,7 +687,7 @@ export async function translateRequestedItems(
return result;
}

const episodesResult = await getEpisodesForPlayback(episode.SeriesId, {
const episodesResult = await getEpisodesForPlayback({
isMissing: false,
seriesId: episode.SeriesId,
userId: userId
Expand Down
Loading