Problem / Context
When the user finishes the last episode of a season, the "Next" button does nothing and auto-advance stops, even when a season N+1 exists. Playback should roll over into the first episode of the next season.
Upstream reference: jarnedemeulemeester#1133
Current behavior in our fork
player/local/src/main/java/dev/jdtech/jellyfin/player/local/domain/PlaylistManager.kt builds the playlist from a single season only: SERIES branch (:59-75), SEASON branch (:77-96), EPISODE branch (:97-111) all call repository.getEpisodes(seasonId = ...) for one season.
getNextPlayerItem() (:165-197) returns null at currentItemIndex == items.lastIndex; items never includes the next season.
Proposed implementation
Port the structure from upstream jarnedemeulemeester#1133 into PlaylistManager.kt, adapting to our signatures:
- Add private helpers:
getEpisodesBySeries(seriesId), getEpisodesBySeason(seasonId), getEpisodesByEpisode(episode)
getEpisodes(currentSeason: FindroidSeason, nextSeason: FindroidSeason?) — concatenates the current season's episodes with the next season's (filter !missing, request ItemFields.CHAPTERS, TRICKPLAY).
- Compute
nextSeason via repository.getSeasons(seriesId).firstOrNull { it.indexNumber == currentSeason.indexNumber + 1 }.
- Replace per-branch episode fetching in
getInitialItem (SERIES/SEASON/EPISODE) with these helpers.
- Verify
getNextPlayerItem/getPreviousPlayerItem and the PlayerViewModel media-item queue handle the larger items list (they index into items, so should work unchanged).
- Confirm
repository.getSeasons returns seasons with indexNumber populated (data/.../JellyfinRepository.kt).
Known compromise (matches upstream): the queue spans current + next season; if a user watches fully through the next season in one session, they won't auto-advance to season N+2 without a re-fetch. Acceptable for a first pass.
Acceptance criteria
Problem / Context
When the user finishes the last episode of a season, the "Next" button does nothing and auto-advance stops, even when a season N+1 exists. Playback should roll over into the first episode of the next season.
Upstream reference: jarnedemeulemeester#1133
Current behavior in our fork
player/local/src/main/java/dev/jdtech/jellyfin/player/local/domain/PlaylistManager.ktbuilds the playlist from a single season only: SERIES branch (:59-75), SEASON branch (:77-96), EPISODE branch (:97-111) all callrepository.getEpisodes(seasonId = ...)for one season.getNextPlayerItem()(:165-197) returnsnullatcurrentItemIndex == items.lastIndex;itemsnever includes the next season.Proposed implementation
Port the structure from upstream jarnedemeulemeester#1133 into
PlaylistManager.kt, adapting to our signatures:getEpisodesBySeries(seriesId),getEpisodesBySeason(seasonId),getEpisodesByEpisode(episode)getEpisodes(currentSeason: FindroidSeason, nextSeason: FindroidSeason?)— concatenates the current season's episodes with the next season's (filter!missing, requestItemFields.CHAPTERS, TRICKPLAY).nextSeasonviarepository.getSeasons(seriesId).firstOrNull { it.indexNumber == currentSeason.indexNumber + 1 }.getInitialItem(SERIES/SEASON/EPISODE) with these helpers.getNextPlayerItem/getPreviousPlayerItemand thePlayerViewModelmedia-item queue handle the largeritemslist (they index intoitems, so should work unchanged).repository.getSeasonsreturns seasons withindexNumberpopulated (data/.../JellyfinRepository.kt).Known compromise (matches upstream): the queue spans current + next season; if a user watches fully through the next season in one session, they won't auto-advance to season N+2 without a re-fetch. Acceptable for a first pass.
Acceptance criteria