Skip to content

Search finds episodes by their own titles - #44

Merged
jpittelkow merged 1 commit into
mainfrom
library-episodes
Nov 10, 2026
Merged

jpittelkow merged 1 commit into
mainfrom
library-episodes

Conversation

@jpittelkow

Copy link
Copy Markdown
Contributor

What this changes and why

Search only knew movie and show names, so typing an episode's title found nothing even when the episode was in the library. Example: "Duck Duck Loon" (Wild Kratts S07E15 "Duck, Duck, Loon!"). #43 makes sure the words as typed are searched for, but the local library copy had no episode titles for them to match. The live guide can't fill the gap either: guides fed from XMLTV through Plex carry no episode titles at all.

  • New Source.library_episodes(), called right after library() on the same timer.
    • Plex: lists each TV section with type=4, leaving out summaries, artwork and media details. That roughly halves each page.
    • Jellyfin: lists Episode items for the configured user.
  • New tables episodes + episodes_fts (title only), rebuilt on each library refresh and cleared on a server switch.
    • If episodes fail to load, the library is still written and the previous episodes stay.
  • search.run returns episodes for text searches over the library.
    • Every word must be in the episode title, and the show must be in the library.
    • At most 20 come back.
    • The show's genres, rating and year stand in for the episode's.
    • split_typed handles episodes too.
  • Results page: a new "Episodes" row of cards showing the show, "S07E15 Duck, Duck, Loon!", ▶ Play (the existing data-rating-key play path, busy check included) and "Open the show".
  • /api/answer lists episode matches, so the AI's one-line answer can name the episode.

Requested by the maintainer. There's no separate issue.

How it was tested

  • python scripts/check.py prints "all checks passed" (tests, guard tests, privacy, JS)
  • New or changed behaviour has a test that fails without this change (tests/test_episodes.py)
  • CHANGELOG.md (Unreleased) updated, if a user would notice
  • For screen changes: checked at phone width and in light and dark mode (desktop dark, 375 px light)

Tried on real hardware: I built this branch and ran it as a separate test copy against a real Plex server with a snapshot of a real install's data. Production wasn't touched.

  • The library refresh read about 44,000 episodes in 23 pages, in about 8 seconds.
  • "Duck Duck Loon", "duck, duck, loon" and "moose nibbles" each found the right episode under "Matches for", with AI on.
  • "Open the show" opened the show page.

Not tested:

  • ▶ Play on an episode card. It wasn't pressed, to avoid starting a real TV; it uses the same play path as the season list's ▶ buttons.
  • A real Jellyfin server. Jellyfin is covered by tests only.

Decisions and docs

ADRs I reviewed for this area: 0005, 0012, 0015, 0016, 0029.

  • This makes or reverses a design decision, and adds or supersedes an ADR: 0030 (Proposed): new Source method and new tables
  • No ADR needed (say why, in a few words):
  • Nothing here goes against an accepted ADR
  • docs/ and the README still match the code, or were updated here (data-model, architecture, api, frontend, testing)

Security (tick what applies)

  • Saves a key or token, or changes where one is sent
  • Calls an address typed in Settings, or a new outside service
  • Changes the X-WhatsOn or host checks, or the check for something already playing on a TV
  • Changes what's sent to Radarr or Sonarr
  • Changes tests/test_guards.py (explain why the rule itself should change)
  • None of the above. The new calls go to the already-configured media server through its existing client.

AI use

  • No AI was used
  • AI helped. Tool, and what it did: Claude Code (Claude Opus 5.5) wrote the change, tests, ADR and docs, and ran the real-server check described above.
  • A person read the whole diff and can explain it

Checks

  • One change only, with no unrelated cleanups
  • No keys, tokens or details of a real home in the code, tests, logs or screenshots
  • No new dependencies, workflow changes or version bumps, or they were agreed in an issue

🤖 Generated with Claude Code

The local library copy held movies and shows only, so an episode's title was
never searched: "Duck Duck Loon" found nothing even with the episode in the
library. Each library refresh now also reads every episode's title, season and
number (Source.library_episodes, Plex type=4 trimmed, Jellyfin Episode items)
into episodes/episodes_fts. Search returns title matches in `episodes`, shown
in an Episodes row with Play and Open the show, and the AI answer sees them.
ADR 0030 (Proposed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jpittelkow
jpittelkow merged commit 1babb02 into main Nov 10, 2026
3 checks passed
@jpittelkow
jpittelkow deleted the library-episodes branch November 10, 2026 21:42
@jpittelkow jpittelkow mentioned this pull request Nov 10, 2026
jpittelkow added a commit that referenced this pull request Nov 10, 2026
Version files and CHANGELOG for 0.2.8: search finds episodes by their
own titles (#44). After merge, tag `v0.2.8` on the merge commit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Jeff Pittelkow <6314033+jpittelkow@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant