Fix playback, account, download and library bugs found in review
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m22s
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m22s
- Clear cached library data when the account or profile behind the server connection changes, not only on Home user switches. - TitleArt falls back to the title when there is no server, so the player no longer crashes offline. - Playback keeps the server it started on: progress, watched state and transcodes never go to a server selected later, a download only reports to its own server, and switching account or server ends a stream from the old one. - Closing or replacing playback during setup can no longer start the file afterwards. - Transcodes save the chosen audio/subtitle tracks on the server before starting (and name them in the request), apply the language and subtitle preferences, and keep the current tracks across quality changes. - Offline playback saves its resume point and watched count in the download's metadata. - Download tasks take over from a previous task for the same title only after it exits, and pause/remove stay wired to the current task. - Downloads prefer a single-file version and refuse split ones instead of saving only part one. - Download artwork is named per file, so episodes in one season folder no longer overwrite or delete each other's images. - Library grids refetch loaded pages when the cache is invalidated. - Request timeouts and cancellation also cover the response body. - Hero rotation resumes after being scrolled back into view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c70aeede74
commit
8755d16735
9 changed files with 399 additions and 99 deletions
|
|
@ -43,14 +43,14 @@ export function Hero({ features, variant = 'home' }: { features: Feature[]; vari
|
|||
img.decode?.().catch(() => {});
|
||||
}, [upcoming?.id]);
|
||||
|
||||
// Pause rotation when the hero is scrolled away; it picks up again on its return.
|
||||
const [visible, setVisible] = useState(true);
|
||||
useEffect(() => {
|
||||
if (!rotate || reduced || count < 2 || hover) return;
|
||||
if (!rotate || reduced || count < 2 || hover || !visible) return;
|
||||
const t = setTimeout(() => go(index + 1), ROTATE_MS);
|
||||
return () => clearTimeout(t);
|
||||
}, [index, rotate, reduced, count, hover]);
|
||||
}, [index, rotate, reduced, count, hover, visible]);
|
||||
|
||||
// Pause rotation when the hero is scrolled away.
|
||||
const [visible, setVisible] = useState(true);
|
||||
useEffect(() => {
|
||||
const el = root.current;
|
||||
if (!el) return;
|
||||
|
|
@ -60,7 +60,6 @@ export function Hero({ features, variant = 'home' }: { features: Feature[]; vari
|
|||
}, []);
|
||||
|
||||
const go = (i: number) => {
|
||||
if (!visible && i !== index) return;
|
||||
setIndex(((i % count) + count) % count);
|
||||
setCopyKey((k) => k + 1);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { memo, useEffect, useRef, useState, type ReactNode } from 'react';
|
||||
import type { Item } from '../plex/types';
|
||||
import { useServer } from '../app/session';
|
||||
import { useServer, useSession } from '../app/session';
|
||||
import { useSettings } from '../app/settings';
|
||||
import { art, displayTitle, duration, episodeLabel, formatBadges, isWatched, progress, remaining, remainingEpisodes } from '../app/format';
|
||||
import { itemMenu, openItem, playWithVersion } from '../app/actions';
|
||||
|
|
@ -90,7 +90,8 @@ export function Facts({ item, withFormats = true, episode = true, children }: {
|
|||
|
||||
/** Original clear-logo artwork, falling back to the title in type. */
|
||||
export function TitleArt({ item, logo, className = '', maxWidth = 420, maxHeight = 130, as: As = 'h1' }: { item: Item; logo?: string; className?: string; maxWidth?: number; maxHeight?: number; as?: 'h1' | 'h2' }) {
|
||||
const server = useServer();
|
||||
// The player shows this offline too, where there is no server to draw the logo from.
|
||||
const server = useSession((s) => s.server);
|
||||
const path = logo ?? item.logo;
|
||||
const [failed, setFailed] = useState(false);
|
||||
const [ready, setReady] = useState(false);
|
||||
|
|
@ -99,7 +100,7 @@ export function TitleArt({ item, logo, className = '', maxWidth = 420, maxHeight
|
|||
setReady(false);
|
||||
}, [path]);
|
||||
const title = item.type === 'episode' ? item.grandparentTitle : item.type === 'season' ? item.parentTitle || item.title : item.title;
|
||||
if (!path || failed)
|
||||
if (!path || failed || !server)
|
||||
return (
|
||||
<As className={`title-text ${className}`} style={{ maxWidth: maxWidth * 1.4 }}>
|
||||
{title}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue