Skip to content

Commit

Permalink
Merge pull request #687 from 3flex/axios-getEpisodesForPlayback
Browse files Browse the repository at this point in the history
Migrate getEpisodesForPlayback to jellyfin-sdk-typescript
  • Loading branch information
nielsvanvelzen authored Nov 7, 2024
2 parents d7be154 + 9f68ae3 commit fc4674c
Showing 1 changed file with 8 additions and 9 deletions.
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

0 comments on commit fc4674c

Please sign in to comment.