From c717a63d39f43ba1139368a52f873d82d6389258 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:29:41 +1100 Subject: [PATCH 1/5] Remove default parameter from ItemQuery There is a single caller of this function and it passes an object. --- src/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers.ts b/src/helpers.ts index 9003e704..9a078b6d 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -598,7 +598,7 @@ export async function getItemsForPlayback( export function getEpisodesForPlayback( userId: string, seriesId: string, - query: ItemQuery = {} + query: ItemQuery ): Promise { query.UserId = userId; query.Fields = requiredItemFields; From 20353957689ea1a2e290306ca2b8aad793b4b438 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:30:59 +1100 Subject: [PATCH 2/5] Remove userId parameter from getEpisodesForPlayback This is already set in the query object at the call site. --- src/helpers.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index 9a078b6d..a5a5b458 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -590,17 +590,14 @@ 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 ): Promise { - query.UserId = userId; query.Fields = requiredItemFields; query.ExcludeLocationTypes = 'Virtual'; @@ -705,7 +702,6 @@ export async function translateRequestedItems( } const episodesResult = await getEpisodesForPlayback( - userId, episode.SeriesId, { IsMissing: false, From 72b7d9702f02905f47488025a8b25df6ade82f97 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:31:46 +1100 Subject: [PATCH 3/5] Don't set ExcludeLocationTypes when calling getEpisodes endpoint This is not a valid query parameter for this endpoint. --- src/helpers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helpers.ts b/src/helpers.ts index a5a5b458..95dda3d0 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -599,7 +599,6 @@ export function getEpisodesForPlayback( query: ItemQuery ): Promise { query.Fields = requiredItemFields; - query.ExcludeLocationTypes = 'Virtual'; return JellyfinApi.authAjax(`Shows/${seriesId}/Episodes`, { dataType: 'json', From e9719011b97d1ef94586c45593bcf844fbb81e65 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:31:59 +1100 Subject: [PATCH 4/5] Don't set IsVirtualUnaired when calling getEpisodes endpoint This is not a valid query parameter for this endpoint. --- src/helpers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helpers.ts b/src/helpers.ts index 95dda3d0..a8007a9d 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -704,7 +704,6 @@ export async function translateRequestedItems( episode.SeriesId, { IsMissing: false, - IsVirtualUnaired: false, UserId: userId } ); From 4b80d0b7914a48e107d92cc0692bc157138b07e1 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:35:05 +1100 Subject: [PATCH 5/5] Use TvShowsApiGetEpisodesRequest type for getEpisodes query parameters --- src/helpers.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index a8007a9d..515209e9 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -4,6 +4,7 @@ import type { MediaSourceInfo, BaseItemDto, BaseItemPerson, + TvShowsApiGetEpisodesRequest, UserDto } from '@jellyfin/sdk/lib/generated-client'; import { JellyfinApi } from './components/jellyfinApi'; @@ -596,13 +597,11 @@ export async function getItemsForPlayback( */ export function getEpisodesForPlayback( seriesId: string, - query: ItemQuery + query: TvShowsApiGetEpisodesRequest ): Promise { - query.Fields = requiredItemFields; - return JellyfinApi.authAjax(`Shows/${seriesId}/Episodes`, { dataType: 'json', - query: query, + query: { ...query, fields: requiredItemFields }, type: 'GET' }); } @@ -700,13 +699,11 @@ export async function translateRequestedItems( return result; } - const episodesResult = await getEpisodesForPlayback( - episode.SeriesId, - { - IsMissing: false, - UserId: userId - } - ); + const episodesResult = await getEpisodesForPlayback(episode.SeriesId, { + isMissing: false, + seriesId: episode.SeriesId, + userId: userId + }); let foundItem = false;