Skip to content

Commit

Permalink
Migrate getItemsForPlayback to jellyfin-sdk-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Nov 10, 2024
1 parent 9237f3b commit 514b442
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {
} from '@jellyfin/sdk/lib/generated-client';
import { getItemsApi, getTvShowsApi } from '@jellyfin/sdk/lib/utils/api';
import { ItemsApiGetItemsRequest } from '@jellyfin/sdk/lib/generated-client/api/items-api';
import { AxiosResponse } from 'axios';
import { JellyfinApi } from './components/jellyfinApi';
import { PlaybackManager, PlaybackState } from './components/playbackManager';
import { BusMessage } from './types/global';
Expand Down Expand Up @@ -574,21 +573,18 @@ export async function getItemsForPlayback(
};

if (query.ids?.length == 1) {
const item = await JellyfinApi.authAjaxUser(`Items/${query.ids[0]}`, {
dataType: 'json',
type: 'GET'
const response = await getItemsApi(JellyfinApi.jellyfinApi).getItems({
...query,
...params
});

return {
Items: [item],
TotalRecordCount: 1
};
return response.data;
} else {
return JellyfinApi.authAjaxUser('Items', {
dataType: 'json',
query: { ...query, ...params },
type: 'GET'
});
const response = await getItemsApi(JellyfinApi.jellyfinApi).getItems(
query
);

return response.data;
}
}

Expand Down

0 comments on commit 514b442

Please sign in to comment.