mirror of
https://github.com/jellyfin/jellyfin-chromecast.git
synced 2024-11-23 05:59:50 +00:00
Migrate getItemsForPlayback to jellyfin-sdk-typescript
This commit is contained in:
parent
d8eee5d989
commit
bfee74f006
@ -14,7 +14,11 @@ import type {
|
||||
ItemFields,
|
||||
ItemsApiGetItemsRequest
|
||||
} from '@jellyfin/sdk/lib/generated-client';
|
||||
import { getInstantMixApi, getTvShowsApi } from '@jellyfin/sdk/lib/utils/api';
|
||||
import {
|
||||
getInstantMixApi,
|
||||
getItemsApi,
|
||||
getTvShowsApi
|
||||
} from '@jellyfin/sdk/lib/utils/api';
|
||||
import { JellyfinApi } from './components/jellyfinApi';
|
||||
import { PlaybackManager, PlaybackState } from './components/playbackManager';
|
||||
import { BusMessage } from './types/global';
|
||||
@ -577,21 +581,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user