mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
fix(stalker): refresh stale embedded-series snapshots from favorites and dashboard (#1253)
Favorites and recently-viewed rows store Stalker items as full JSON snapshots, so a vclub-style embedded series[] episode list froze at the moment the row was written: a series favorited when only episode 1 was out kept showing one episode forever when opened from favorites, recents, Continue Watching, or any dashboard rail. New withStalkerSnapshotRefresh() store feature renders the stored snapshot immediately and re-fetches the item from the portal in the background via a title search (get_ordered_list&type=vod&search=..., matched by id, paginated up to 5 pages, wildcard-category retry), patching fresh episodes and cmd into the active selection. The patch is guarded on both the item id and the active playlist id, since Stalker ids are only unique per portal. Only the in-memory selection is patched — the stored snapshot row is deliberately left alone, because every entry path into the detail view runs this refresh and writing it back would add an uncontrolled background writer to the whole-playlist read-modify-write that every favorite/recent mutation performs. Also fixes the stalker-mock-server embedded-series scenario, which generated series[] as objects the app's vclub adapters filter out instead of the episode-number arrays real portals send. Regular type=series and Ministra is_series items are unaffected; Xtream is unaffected (get_series_info is never cached). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d63f76407
commit
9885178f32
12 files changed
+773
-14
No files matched your search
@@ -55,7 +55,8 @@ export interface RawVodItem {
|
||||
category_id: string;
|
||||
is_series: 0 | 1 | '1';
|
||||
has_files: number;
|
||||
series?: RawEmbeddedEpisode[];
|
||||
/** vclub-style embedded episode numbers, e.g. ['1', '2', '3'] */
|
||||
series?: string[];
|
||||
}
|
||||
|
||||
export interface RawSeriesItem {
|
||||
@@ -95,12 +96,6 @@ export interface RawSeason {
|
||||
series: string[];
|
||||
}
|
||||
|
||||
export interface RawEmbeddedEpisode {
|
||||
id: number;
|
||||
name: string;
|
||||
cmd: string;
|
||||
}
|
||||
|
||||
export interface RawEpgProgram {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -388,19 +383,19 @@ function generateVodItems(
|
||||
};
|
||||
|
||||
if (hasEmbeddedSeries) {
|
||||
item.series = generateEmbeddedEpisodes(id, seasonsPerSeries * episodesPerSeason);
|
||||
// Real vclub portals expose embedded episodes as an array of
|
||||
// episode numbers; playback appends the number to the item cmd.
|
||||
item.series = generateEmbeddedEpisodes(
|
||||
seasonsPerSeries * episodesPerSeason
|
||||
);
|
||||
}
|
||||
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
function generateEmbeddedEpisodes(parentId: string, count: number): RawEmbeddedEpisode[] {
|
||||
return Array.from({ length: count }, (_, i) => ({
|
||||
id: parseInt(parentId) * 100 + i,
|
||||
name: `Episode ${i + 1}`,
|
||||
cmd: `ffrt4://vod/${parentId}/ep${i + 1}/index.m3u8`,
|
||||
}));
|
||||
function generateEmbeddedEpisodes(count: number): string[] {
|
||||
return Array.from({ length: count }, (_, i) => String(i + 1));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user