Repository navigation
feat(sources): pin the recently played source to the top of the source list - #790
Conversation
…e list When a title is reopened, the source it was last really watched from leads the source picker with a "Recently played" chip, ahead of the normal sort. - One record per title per profile (last 200 titles kept); playing another source or episode replaces it. - A source is recorded only after 10 s of real playback on it. Pausing, buffering and seeks do not count, and a new selection (manual or failover) starts over, so a source abandoned for being slow or broken is never kept. - Later source lists are matched by URL, then torrent hash + file index, then filename, then source text, always within the same addon. The addon's own entry is recorded, not the copy resolved for playback. - Shown in the Details source picker (TV and mobile) and the player's source menu. Series match the exact episode only. Live streams are skipped.
Autoplay users never see the source list, so the pin alone did nothing for them. When the title has a recently played source, autoplay now picks it over its own ranking. - Its addon may answer after autoplay's quick picks (a cached source, the 1.75 s window) would fire, so those hold for up to 6 s while it is missing. The hold ends as soon as it arrives, when the search finishes, or when it arrives but the autoplay quality settings filter it out. - Titles without a recent source autoplay exactly as before. - Failover is unchanged: it walks the source list and never re-picks the recent source through autoplay.
|
Thanks for adding this, remembering the source that actually worked is a useful improvement. Two timing cases need fixing before merging:
Please add regression tests for both cases. The build checks pass and the PR merges cleanly; these are playback-timing gaps, not video-quality concerns. |
1. A slow source switch could save the replacement as recently played. selectStream() names the replacement in selectedStream right away, while the old video keeps playing until the new URL is resolved and applied. Playback is now credited to the source the player has actually loaded (preparedStream, set wherever a URL is applied), and nothing counts while a replacement is resolving. A failed switch keeps crediting the source that is still playing. 2. Home Server / IPTV background results could autoplay before the recent-source hold existed, since it was only set up by the first addon result. The hold is now a RecentSourceAutoplayGate armed at the start of loading, before any lookup starts, with its own 6 s timer. Every autoplay entry point goes through autoplaySelectBest, which respects it. Regression tests: RecentSourcePlaybackTimingTest (slow switch, failed switch, early background result held, hold expiry, no recent source) and RecentSourceAutoplayGateTest.
|
Thanks @ProdigyV21 - all issues fixed |
What
When you reopen a movie or episode, the source you last actually watched it from is pinned to the top of the source list with a "Recently played" chip, ahead of the normal sort. Focus lands on it, so resuming is one click.
Rules
Where it shows
Autoplay
Users with "autoplay single source" never see the list, so autoplay now picks the recent source over its own ranking.
Changes
RecentPlayedSource(model + matcher),RecentPlayedSourceRepository(per-profile DataStore),RecentSourcePlayTracker(the 10 s rule).PlayerViewModelfeeds the tracker fromsaveProgressand prefers the record inautoplaySelectBest, holding the quick autoplay picks while it's missing.DetailsViewModelloads the record when sources open.StreamSelectorpins the match and draws the chip.stream_recently_playedin English and Hebrew.Testing
RecentPlayedSourceTest(8) andRecentSourcePlayTrackerTest(7).DetailsStreamCompletionTest,DetailsWatchlistToggleTestandForcedSubtitleSelectionTestupdated for the new constructor parameter; all pass.🤖 Generated with Claude Code