Skip to content

Continue "next episode" into the following season #29

Description

@midasvo

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:

  1. 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).
  2. Compute nextSeason via repository.getSeasons(seriesId).firstOrNull { it.indexNumber == currentSeason.indexNumber + 1 }.
  3. Replace per-branch episode fetching in getInitialItem (SERIES/SEASON/EPISODE) with these helpers.
  4. Verify getNextPlayerItem/getPreviousPlayerItem and the PlayerViewModel media-item queue handle the larger items list (they index into items, so should work unchanged).
  5. 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

  • Finishing the last episode of season N auto-advances to season N+1 episode 1 (subject to the existing still-watching prompt).
  • The "Next" button is enabled on the last episode of a season when a next season exists.
  • No regression for the last episode of the last season (returns null / ends playback).
  • Starting playback from a series, a season, or an episode all build a queue spanning into the next season.
  • The relevant player module compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestupstream-portFeature/fix ported or inspired by upstream jarnedemeulemeester/findroid

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions