Skip to content

Show list Next/Prev Ep can show a Season 0 special's date instead of the real next/previous episode #12250

Description

@DavidHunterJS

Describe the bug
The show list "Next Ep" / "Prev Ep" columns (and anywhere else that reads Series.next_airdate / Series.prev_airdate) can surface a Season 0 special/short instead of the actual next/previous numbered episode. Series.next_episode() and Series.prev_episode() in medusa/tv/series.py query tv_episodes with no season > 0 filter, so a season-0 row (TVDB shorts/specials) with a nearby airdate wins purely on ORDER BY airdate, regardless of season or (for next_episode) status.

Concretely, for a show whose latest real episode aired months ago but which has a Season 0 short scheduled soon, the homepage will show that short's date as "Next Ep" — implying a new numbered episode is imminent — when in fact nothing is scheduled for the actual series. This is inconsistent with how the rest of the codebase treats specials: e.g. medusa/schedulers/episode_updater.py explicitly special-cases season 0 (cur_ep.status = series_obj.default_ep_status if cur_ep.season else common.SKIPPED) because "specials are not supported." next_episode()/prev_episode() don't apply the same exclusion.

To Reproduce

  1. Find (or set up) a show where the last real numbered-season episode aired well in the past, but a season-0 entry (short/special) has an airdate today or in the future.
  2. Load the show list page. The "Next Ep" column shows the season-0 entry's date, not "no next episode" / the show's actual status.
  3. Confirm via DB: SELECT season, episode, name, airdate, status FROM tv_episodes WHERE showid=<id> ORDER BY season DESC, episode DESC — the highest real season's last episode is far in the past, while a season=0 row has the airdate the UI is showing.

Example hit on my instance: "The Simpsons" — last real episode is S37E15 (aired 2026-02-15, status Snatched), but the show list showed "Next Ep: 2026-07-26", which turned out to be S00E80 "Yellow Mirror" (status Skipped) — a promotional short, not part of season 37.

Expected behavior
next_episode() / prev_episode() should only consider season > 0 when determining the next/previous series episode, matching how specials are excluded elsewhere in the codebase. If no real next episode is known, the UI should reflect that (e.g. fall back to the show's status, "Continuing") rather than surfacing an unrelated special's date.

Suggested fix
Add AND season > 0 to the WHERE clause in both next_episode() and prev_episode() (medusa/tv/series.py). Happy to submit this as a PR.

Medusa (please complete the following information):

  • OS: Debian GNU/Linux 12 (bookworm)
  • Branch: master
  • Commit: 2bc1eb2
  • Python version: 3.11.2
  • Database version: 44.19

Debug logs (at least 50 lines):
Not applicable — this is a query-logic bug reproducible directly via the DB query above, not something that surfaces as an error in the application log.

Additional context
Related to, but distinct from, #12249 (single-episode PATCH not persisting) — found while investigating the same instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions