Fix missing pagination in episode fetching for series with >500 episodes#237
Open
skilaky wants to merge 1 commit into
Open
Fix missing pagination in episode fetching for series with >500 episodes#237skilaky wants to merge 1 commit into
skilaky wants to merge 1 commit into
Conversation
GetSeriesEpisodesAsync and GetEpisodeTvdbId only fetched page 0 (first 500 episodes) from the TVDB v4 API. For long-running series like Tatort (1340 episodes in DVD order), episodes beyond page 0 were invisible to the plugin, causing incorrect season/episode assignments. This adds pagination loops (matching the existing pattern in GetUpdates) to both methods so all episodes are fetched across all pages. Fixes incorrect metadata for any series with more than 500 episodes in a given season type ordering.
e27ea28 to
013eb0b
Compare
Shadowghost
reviewed
Mar 26, 2026
| return seriesResult.Data; | ||
|
|
||
| // Each page has a limit of 500 episodes. Fetch all remaining pages. | ||
| var allEpisodes = new List<EpisodeBaseRecord>(seriesResult.Data?.Episodes ?? Array.Empty<EpisodeBaseRecord>()); |
Contributor
There was a problem hiding this comment.
Suggested change
| var allEpisodes = new List<EpisodeBaseRecord>(seriesResult.Data?.Episodes ?? Array.Empty<EpisodeBaseRecord>()); | |
| var allEpisodes = new List<EpisodeBaseRecord>(seriesResult.Data?.Episodes ?? []); |
Same for other places
|
I think some of my code from #242 should be added into this, because the endpoint used in both places has a long-standing flaw where season-types 'altdvd' and 'alttwo' return no episodes even when there are. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetSeriesEpisodesAsync()andGetEpisodeTvdbId()inTvdbClientManager.csonly fetched page 0 (first 500 episodes) from the TVDB v4 APIRoot Cause
The TVDB v4 API returns a maximum of 500 episodes per page. Both methods had
page: 0hardcoded with no pagination loop. The same codebase already has working pagination inGetUpdates(), but it was never applied to episode fetching.Example: Tatort (TVDB ID: 83214)
Tatort has 1,340 episodes in DVD order, spread across 3 API pages:
Before fix: Episodes from seasons 52+ (pages 1-2) were invisible → 95% of episodes had wrong season/episode metadata.
After fix: All pages are fetched, all seasons are correctly mapped.
Changes
GetSeriesEpisodesAsync(): Added pagination loop to aggregate episodes from all pages into a singleData2result (matching the existingGetUpdates()pattern)GetEpisodeTvdbId(): Added pagination loop to iterate through pages until the requested episode is foundAffected Series
Any series with >500 episodes in a season type ordering, including:
Test Plan
MissingEpisodeProvidercreates correct virtual seasons for all pages