E5 S4: Plex Discover rail-surface (default landing)
A dedicated Plex "Discover" landing — a stack of horizontal Carousel rails served from ONE consolidated read (serve-from-DB, no live Plex/TMDB call): - GET /api/plex/discover → continue_watching (in-progress movies + shows, most recently progressed) · recently_added · genres (top-N tiles) · because_you_watched (recs of the most-recent watched, TMDB-enriched movie, resolved to library rows by guid via serve_block's resolver). - GET /api/plex/surprise → a fresh random, scope-bounded sample for the ↻ rail. Frontend: PlexDiscover.tsx (rails reuse the S1 Carousel + S3 PlexPosterCard; colored genre tiles → tap to filter the grid; ↻ reshuffles the surprise rail alone). Discover is now the root sub-view; the flat grid becomes the bookmarkable "Browse all" secondary view (?v=browse) reached by a header search/filter (a browse-intent flip) or the new Discover⟷Browse toggle. resolve_recs is promoted from _resolve_recs (now cross-module). Tests: test_plex_discover.py (rail shape/order, continue-watching, because-you-watched + null, surprise bounds, scope) and PlexDiscover.dom.test.tsx; plexSubUrl round-trip updated for discover-root/grid-browse. Backend lane 393, vitest 332.
This commit is contained in:
@@ -263,6 +263,17 @@ export interface PlexPlaySession {
|
||||
start_s: number;
|
||||
}
|
||||
|
||||
// Discover surface (E5 S4): the consolidated rail payload. Every rail is a plain PlexCard list the
|
||||
// dedicated Discover landing renders as a horizontal Carousel; `because_you_watched` is null when the
|
||||
// user has no TMDB-enriched watch history (rail hidden). Served from DB — no live Plex/TMDB call.
|
||||
export interface PlexDiscover {
|
||||
scope: string;
|
||||
continue_watching: PlexCard[];
|
||||
recently_added: PlexCard[];
|
||||
genres: { value: string; count: number }[]; // top genres → tap a tile to filter the grid
|
||||
because_you_watched: { anchor: { id: string; title: string }; items: PlexCard[] } | null;
|
||||
}
|
||||
|
||||
// Two-way Plex watch-state sync link status (owner account; Phase A).
|
||||
export interface PlexWatchLink {
|
||||
linked: boolean;
|
||||
@@ -411,6 +422,18 @@ export const plexApi = {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ item_rating_keys: itemRks }),
|
||||
}),
|
||||
// Discover landing rails in one request (serve-from-DB). `lang` picks the genre-tile vocabulary.
|
||||
plexDiscover: (scope: string, lang?: string): Promise<PlexDiscover> => {
|
||||
const u = new URLSearchParams({ scope });
|
||||
if (lang === "hu") u.set("lang", "hu");
|
||||
return req(`/api/plex/discover?${u.toString()}`);
|
||||
},
|
||||
// A fresh random sample for the Surprise-me rail — a new draw every call (the ↻ refetch).
|
||||
plexSurprise: (scope: string, limit?: number): Promise<{ scope: string; items: PlexCard[] }> => {
|
||||
const u = new URLSearchParams({ scope });
|
||||
if (limit) u.set("limit", String(limit));
|
||||
return req(`/api/plex/surprise?${u.toString()}`);
|
||||
},
|
||||
plexShow: (id: string, lang?: string): Promise<PlexShowDetail> =>
|
||||
req(`/api/plex/show/${encodeURIComponent(id)}${lang === "hu" ? "?lang=hu" : ""}`),
|
||||
// Mark a whole show / season watched or unwatched (all its episodes) for the current user.
|
||||
|
||||
Reference in New Issue
Block a user