mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 11:06:16 -08:00
fix(stalker): preserve VOD series season shape
This commit is contained in:
1 parent
9a69a6d46a
commit
7ee6e97ceb
5 files changed
+62
-2
No files matched your search
+43
@@ -197,6 +197,49 @@ describe('stalker-operation-adapter', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves the distinct VOD-series season request shape', () => {
|
||||
const mapped = mapRemote(
|
||||
STALKER_SESSION_APPLICATION_OPERATIONS.SeriesSeasons,
|
||||
{
|
||||
contentType: 'vod',
|
||||
seriesId: '51',
|
||||
}
|
||||
);
|
||||
|
||||
expect(mapped.parameters).toEqual({
|
||||
action: 'get_ordered_list',
|
||||
JsHttpRequest: '1-xml',
|
||||
movie_id: '51',
|
||||
p: 1,
|
||||
type: 'vod',
|
||||
});
|
||||
expect(
|
||||
mapped.mapResult({
|
||||
js: {
|
||||
data: [
|
||||
{
|
||||
id: 'season-2',
|
||||
is_season: '1',
|
||||
name: 'Season 2',
|
||||
season_number: '2',
|
||||
video_id: '51',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
).toEqual({
|
||||
seasons: [
|
||||
{
|
||||
id: 'season-2',
|
||||
isSeason: true,
|
||||
number: 2,
|
||||
title: 'Season 2',
|
||||
videoId: '51',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('normalizes catalog pages through an allowlist and drops secret-shaped raw fields', () => {
|
||||
const mapped = mapRemote(
|
||||
STALKER_SESSION_APPLICATION_OPERATIONS.CatalogItems,
|
||||
|
||||
+10
-2
@@ -163,13 +163,19 @@ function mapSearch<Operation extends StalkerSessionApplicationOperation>(
|
||||
function mapSeasons<Operation extends StalkerSessionApplicationOperation>(
|
||||
parameters: StalkerSessionOperationParameters<Operation>
|
||||
): StalkerMappedOperation<Operation> {
|
||||
const seriesId = readEntityId(readRecord(parameters)['seriesId']);
|
||||
const record = readRecord(parameters);
|
||||
const seriesId = readEntityId(record['seriesId']);
|
||||
const contentType =
|
||||
record['contentType'] === undefined
|
||||
? 'series'
|
||||
: readContentType(record['contentType'], ['series', 'vod']);
|
||||
return remote(
|
||||
{
|
||||
action: 'get_ordered_list',
|
||||
JsHttpRequest: JS_HTTP_REQUEST,
|
||||
movie_id: seriesId,
|
||||
type: 'series',
|
||||
...(contentType === 'vod' ? { p: 1 } : {}),
|
||||
type: contentType,
|
||||
},
|
||||
mapSeasonResult
|
||||
);
|
||||
@@ -410,9 +416,11 @@ function mapSeasonResult(value: unknown): StalkerSessionSeasonsResult {
|
||||
number,
|
||||
command: optionalString(record['cmd']),
|
||||
episodeNumbers: readNumberArray(record['series']),
|
||||
isSeason: optionalBoolean(record['is_season']),
|
||||
title:
|
||||
optionalString(record['name']) ??
|
||||
optionalString(record['title']),
|
||||
videoId: optionalEntityId(record['video_id']),
|
||||
}),
|
||||
];
|
||||
});
|
||||
|
||||
@@ -365,8 +365,10 @@ describe('mapStalkerSessionResultToLegacyResponse', () => {
|
||||
command: '/series/42',
|
||||
episodeNumbers: [3, 4],
|
||||
id: '42:2',
|
||||
isSeason: true,
|
||||
number: 2,
|
||||
title: 'Season 2',
|
||||
videoId: '42',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -376,9 +378,11 @@ describe('mapStalkerSessionResultToLegacyResponse', () => {
|
||||
{
|
||||
cmd: '/series/42',
|
||||
id: '42:2',
|
||||
is_season: true,
|
||||
name: 'Season 2',
|
||||
season_number: 2,
|
||||
series: [3, 4],
|
||||
video_id: '42',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -148,10 +148,12 @@ export function mapStalkerSessionResultToLegacyResponse<
|
||||
js: seasons.seasons.map((season) =>
|
||||
compact({
|
||||
id: season.id,
|
||||
is_season: season.isSeason,
|
||||
season_number: season.number,
|
||||
name: season.title,
|
||||
cmd: season.command,
|
||||
series: season.episodeNumbers,
|
||||
video_id: season.videoId,
|
||||
})
|
||||
),
|
||||
};
|
||||
|
||||
@@ -58,6 +58,7 @@ export interface StalkerSessionSearchParameters {
|
||||
|
||||
export interface StalkerSessionSeriesSeasonsParameters {
|
||||
seriesId: StalkerSessionEntityId;
|
||||
contentType?: 'series' | 'vod';
|
||||
}
|
||||
|
||||
export interface StalkerSessionSeriesEpisodesParameters {
|
||||
@@ -156,6 +157,8 @@ export interface StalkerSessionCategoriesResult {
|
||||
export interface StalkerSessionSeason {
|
||||
id: StalkerSessionEntityId;
|
||||
number: number;
|
||||
isSeason?: boolean;
|
||||
videoId?: StalkerSessionEntityId;
|
||||
title?: string;
|
||||
command?: string;
|
||||
episodeNumbers?: readonly number[];
|
||||
|
||||
Reference in new issue
Block a user