feat(sports): One list across leagues, Live Now first #27

Merged
namillis merged 1 commit from feat/sports-rethink into main 2026-11-03 06:05:32 +00:00
Owner

What's wrong

Sports lists ESPN's scoreboards, and pressing OK on a game opened a picker of the user's channels that carry it. That press took seconds. The picker matched the game against every channel the provider lists (about 8,600) and their guide listings, on the thread that draws the screen. On the emulator that froze the app for 1.7 seconds, and a TV box is several times slower. After a cold start it also waited for the full channel list and the ~64 MB guide to download.

The result was noisy, too. For Bears @ Seahawks the picker listed about 40 channels. The streams made for that game ("NFL GAME 01 : MNF CHICAGO BEARS @ SEATTLE…") came after about 20 ESPN feeds.

The IPTV pool, the provider this app is mostly used with, combines several providers' streams. It has a Live Now category: one channel per live event, which switches to another provider's stream if one drops. Sports never looked at it.

Standings were a second view Gabriel asked to drop, and each league switch downloaded them.

What changed

Sports is now one list of every league's games. It follows the Option A mockup Gabriel picked over a list-and-preview layout (design/mockups/bgrid/sports/a-*.png).

  • Sections run On now, Coming up, then Finished (faded until focused). League chips filter the list and show each league's game count, and empty leagues are hidden.
  • Each unfinished game ends with where OK will play it from:
    • Live Now: the pool's Live Now channel. It counts only if its event names both teams and starts within 12 hours of the game.
    • A channel name: the best of the user's channels, ranked exactly as the old picker ranked them.
    • Finding…: shown while the channels load.
    • No stream found: shown once the channel list and the guide have both been searched.
  • OK plays it at once, with no matching left to do. Right opens an Other channels panel: the Live Now channel first (tagged BEST), then the channel matches with a plain reason ("Guide lists this game", "Named after this game").
  • With no stream found, OK switches to Search and runs the away team's name.
  • Standings are gone.

All the matching happens in the background while the list is on screen:

  • Sports asks ESPN for every league at once and fetches the pool's Live Now category. That is one small request, or none when Home has already loaded the full channel list, which contains it. On the emulator, live games showed Live Now about 3 seconds after Sports opened.
  • ChannelMatcher (new, feature/sports/data) prepares the channels and guide once and indexes them by word. It then scores only the channels a game could be on. The scoring rules moved there unchanged from SportsRepository, whose matchChannels now wraps it, so the existing matcher tests still cover them.
  • The two regexes in tokenize are compiled once instead of on every call.

Other files:

  • SportsList holds the list rules.
  • PendingSearch hands the query to Search.
  • LiveChannelCache.cached and ProviderRepository.cachedLiveChannels read the channel list without loading it.
  • SearchViewModel builds the same matcher once for its own game picker, so its picker results are unchanged but it no longer re-prepares them on each open.
  • SearchScreen runs a handed-over query and focuses its results.
  • LiveWireNavHost passes Sports a way to open Search.
  • README.md is updated.

Not a goal: changing how channel matches are ranked against each other, or the README's Sports screenshot. That screenshot (docs/images/sports.jpg) still shows the old screen, and I'll redo it with the demo provider separately.

Checks

  • testDebugUnitTest: 563 pass. 20 are new: 19 in SportsListTest, and one in SportsMatchTest checking that a single matcher serves several games.
  • lintDebug: 0 errors, 14 warnings, none in changed files.
  • assembleDebug: OK.
  • Emulator, debug build, the pool as provider, 70 games across the leagues:
    • Opening the Other channels panel: worst frame 69 ms. The old picker took 1.7 s before its first frame.
    • OK played Suns @ Warriors on its Live Now channel. Its panel listed Live Now first, then the Phoenix and Bay Area channels the guide confirms, then the two per-event streams.
    • Back closed the panel with focus on the same game. The NHL chip showed only NHL's 4 games.
    • Search hand-off: no game lacked a stream at the time, so I forced one with a temporary change (since removed). New Mexico @ Nevada showed No stream found, and OK opened Search with "New Mexico" run, focus on the results and the keyboard closed.
  • Not measured: timings on a real TV box, the word index's memory, or a provider without a Live Now category (every game then goes through the channel matcher, as before).

Screenshots

I'll add these in a comment:

  1. On now, with Live Now on the focused game.
  2. The Other channels panel.
  3. Coming up and Finished.
  4. The NHL filter.
  5. No stream found (forced, see Checks).
  6. Search after the hand-off.
## What's wrong Sports lists ESPN's scoreboards, and pressing OK on a game opened a picker of the user's channels that carry it. That press took seconds. The picker matched the game against every channel the provider lists (about 8,600) and their guide listings, on the thread that draws the screen. On the emulator that froze the app for 1.7 seconds, and a TV box is several times slower. After a cold start it also waited for the full channel list and the ~64 MB guide to download. The result was noisy, too. For Bears @ Seahawks the picker listed about 40 channels. The streams made for that game ("NFL GAME 01 : MNF CHICAGO BEARS @ SEATTLE…") came after about 20 ESPN feeds. The IPTV pool, the provider this app is mostly used with, combines several providers' streams. It has a Live Now category: one channel per live event, which switches to another provider's stream if one drops. Sports never looked at it. Standings were a second view Gabriel asked to drop, and each league switch downloaded them. ## What changed Sports is now one list of every league's games. It follows the Option A mockup Gabriel picked over a list-and-preview layout (`design/mockups/bgrid/sports/a-*.png`). - Sections run On now, Coming up, then Finished (faded until focused). League chips filter the list and show each league's game count, and empty leagues are hidden. - Each unfinished game ends with where OK will play it from: - **Live Now**: the pool's Live Now channel. It counts only if its event names both teams and starts within 12 hours of the game. - **A channel name**: the best of the user's channels, ranked exactly as the old picker ranked them. - **Finding…**: shown while the channels load. - **No stream found**: shown once the channel list and the guide have both been searched. - OK plays it at once, with no matching left to do. Right opens an Other channels panel: the Live Now channel first (tagged BEST), then the channel matches with a plain reason ("Guide lists this game", "Named after this game"). - With no stream found, OK switches to Search and runs the away team's name. - Standings are gone. All the matching happens in the background while the list is on screen: - Sports asks ESPN for every league at once and fetches the pool's Live Now category. That is one small request, or none when Home has already loaded the full channel list, which contains it. On the emulator, live games showed Live Now about 3 seconds after Sports opened. - `ChannelMatcher` (new, `feature/sports/data`) prepares the channels and guide once and indexes them by word. It then scores only the channels a game could be on. The scoring rules moved there unchanged from `SportsRepository`, whose `matchChannels` now wraps it, so the existing matcher tests still cover them. - The two regexes in `tokenize` are compiled once instead of on every call. Other files: - `SportsList` holds the list rules. - `PendingSearch` hands the query to Search. - `LiveChannelCache.cached` and `ProviderRepository.cachedLiveChannels` read the channel list without loading it. - `SearchViewModel` builds the same matcher once for its own game picker, so its picker results are unchanged but it no longer re-prepares them on each open. - `SearchScreen` runs a handed-over query and focuses its results. - `LiveWireNavHost` passes Sports a way to open Search. - `README.md` is updated. Not a goal: changing how channel matches are ranked against each other, or the README's Sports screenshot. That screenshot (`docs/images/sports.jpg`) still shows the old screen, and I'll redo it with the demo provider separately. ## Checks - `testDebugUnitTest`: 563 pass. 20 are new: 19 in `SportsListTest`, and one in `SportsMatchTest` checking that a single matcher serves several games. - `lintDebug`: 0 errors, 14 warnings, none in changed files. - `assembleDebug`: OK. - Emulator, debug build, the pool as provider, 70 games across the leagues: - Opening the Other channels panel: worst frame 69 ms. The old picker took 1.7 s before its first frame. - OK played Suns @ Warriors on its Live Now channel. Its panel listed Live Now first, then the Phoenix and Bay Area channels the guide confirms, then the two per-event streams. - Back closed the panel with focus on the same game. The NHL chip showed only NHL's 4 games. - Search hand-off: no game lacked a stream at the time, so I forced one with a temporary change (since removed). New Mexico @ Nevada showed No stream found, and OK opened Search with "New Mexico" run, focus on the results and the keyboard closed. - Not measured: timings on a real TV box, the word index's memory, or a provider without a Live Now category (every game then goes through the channel matcher, as before). ## Screenshots I'll add these in a comment: 1. On now, with Live Now on the focused game. 2. The Other channels panel. 3. Coming up and Finished. 4. The NHL filter. 5. No stream found (forced, see Checks). 6. Search after the hand-off.
Author
Owner

Intent: pressing OK on a game in Sports plays it straight away, from the pool's Live Now channel when there is one. Every league's games are in one list, and Standings are gone.

Not a goal: changing how channel matches rank against each other, Search's own results, or the README's Sports screenshot (separate change).

Review focus:

  • How ChannelMatcher picks candidates. It must never drop a channel the old full scan would have matched, and the existing SportsMatchTest cases pin that down.
  • The Live Now match rule: both teams named, and starting within 12 hours of the game.
  • The Search hand-off. It was verified on the emulator only with a temporary forced "No stream found" game, since none occurred naturally.
**Intent:** pressing OK on a game in Sports plays it straight away, from the pool's Live Now channel when there is one. Every league's games are in one list, and Standings are gone. **Not a goal:** changing how channel matches rank against each other, Search's own results, or the README's Sports screenshot (separate change). **Review focus:** - How `ChannelMatcher` picks candidates. It must never drop a channel the old full scan would have matched, and the existing `SportsMatchTest` cases pin that down. - The Live Now match rule: both teams named, and starting within 12 hours of the game. - The Search hand-off. It was verified on the emulator only with a temporary forced "No stream found" game, since none occurred naturally.
feat(sports): One list across leagues, Live Now first
All checks were successful
CI / test (pull_request) Successful in 5m47s
4d7452fc30
Opening a game took seconds: the channel picker matched the game
against every channel and its guide listings on the main thread (1.7 s
on the emulator, longer on a TV box), and after a cold start it waited
for the full channel list and guide. The pool's Live Now channels were
not checked first, so the per-event streams sat below ~20 network
matches.

Sports is now one list of every league's games: On now, Coming up,
Finished. League chips filter it. Each unfinished game ends with where
OK plays it from, worked out in the background as Sports opens: the
pool's Live Now channel (matched by team names), else the best channel
match, Finding while the channels load, or No stream found. OK plays
it at once; Right opens an Other channels panel. With no stream, OK
hands the team name to Search.

ChannelMatcher prepares the channels and guide once and scores only
channels a game could be on. The ranking rules are unchanged and the
existing matcher tests still pass. Search reuses one matcher instead
of rebuilding per picker open.

Standings are removed.
namillis deleted branch feat/sports-rethink 2026-11-03 06:05:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
namillis/LiveWireTV!27
No description provided.