Release Kaleido Desktop 0.1.0-beta.13
- Automatic intro/credits skip waits a configurable delay (default 5 s) with a filling "Skipping intro" button; pausing, seeking or pressing a key cancels it, and seeking into an intro never auto-skips it. - Watch-state queries refetch on window focus, and Continue Watching / next episode poll every minute while visible, so progress from other Plex apps shows up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9729755dc9
commit
70591b9d58
15 changed files with 139 additions and 24 deletions
|
|
@ -1,5 +1,14 @@
|
|||
# Changelog
|
||||
|
||||
## 0.1.0-beta.13
|
||||
|
||||
A gentler automatic intro skip, and home screens that keep up with your other Plex apps.
|
||||
|
||||
- "Skip automatically" for intros (and credits) now waits a moment first: the Skip button reads "Skipping intro" and fills as it counts down, then skips. Pause, seek or press any key before then to keep watching; the button stays as a regular Skip intro for the rest of the intro. Click it to skip straight away.
|
||||
- Choose how long it waits in Settings → Playback → Automatic skip delay (3, 5 or 10 seconds, or straight away as before). It's 5 seconds by default.
|
||||
- Jumping into the middle of an intro yourself no longer skips it automatically.
|
||||
- Fixed: Continue Watching, a show's next episode, and watched marks didn't update after watching something on another device (a TV, a phone) while Kaleido stayed open. They now refresh when you switch back to Kaleido, and Continue Watching also refreshes every minute while it's on screen.
|
||||
|
||||
## 0.1.0-beta.12
|
||||
|
||||
A smoother miniplayer on Windows.
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "kaleido-desktop",
|
||||
"version": "0.1.0-beta.12",
|
||||
"version": "0.1.0-beta.13",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "kaleido-desktop",
|
||||
"version": "0.1.0-beta.12",
|
||||
"version": "0.1.0-beta.13",
|
||||
"dependencies": {
|
||||
"@fontsource-variable/inter": "^5.3.0",
|
||||
"@tanstack/react-query": "^5.105.0",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "kaleido-desktop",
|
||||
"private": true,
|
||||
"version": "0.1.0-beta.12",
|
||||
"version": "0.1.0-beta.13",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
|
|
|||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
|
|
@ -2173,7 +2173,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "kaleido"
|
||||
version = "0.1.0-beta.12"
|
||||
version = "0.1.0-beta.13"
|
||||
dependencies = [
|
||||
"fs2",
|
||||
"futures-util",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "kaleido"
|
||||
version = "0.1.0-beta.12"
|
||||
version = "0.1.0-beta.13"
|
||||
description = "Kaleido — a Plex client for Windows"
|
||||
authors = ["Elijah"]
|
||||
edition = "2021"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Kaleido",
|
||||
"version": "0.1.0-beta.12",
|
||||
"version": "0.1.0-beta.13",
|
||||
"identifier": "tv.kaleido.desktop",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,18 @@ export const queryClient = new QueryClient({
|
|||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Watch state changes from other Plex apps too (a TV, a phone), so the queries that show
|
||||
* it refresh when Kaleido comes back into view and, for the progress rows, every minute
|
||||
* while it is on screen. Polling pauses while the window is hidden or minimised.
|
||||
*/
|
||||
export const WATCH_STATE = { refetchOnWindowFocus: true } as const;
|
||||
export const PROGRESS = { ...WATCH_STATE, staleTime: 15_000, refetchInterval: 60_000 } as const;
|
||||
|
||||
// React Query treats a visibility change as focus. Switching back to Kaleido from another
|
||||
// app doesn't change visibility, so a window focus counts as well.
|
||||
window.addEventListener('focus', () => queryClient.getQueryCache().onFocus());
|
||||
|
||||
/** Every key starts with the server so switching servers never mixes caches. */
|
||||
export function useKey(...parts: unknown[]) {
|
||||
const server = useServer();
|
||||
|
|
@ -37,9 +49,9 @@ export function useSectionFor(kind: 'movie' | 'show'): { section: Section | null
|
|||
}
|
||||
|
||||
export const useItem = (id: string | undefined, opts: Partial<UseQueryOptions<Item>> = {}) =>
|
||||
useServerQuery(['item', id], (s) => api.metadata(s, id!), { enabled: !!id, staleTime: 30_000, ...opts });
|
||||
useServerQuery(['item', id], (s) => api.metadata(s, id!), { enabled: !!id, staleTime: 30_000, ...WATCH_STATE, ...opts });
|
||||
|
||||
export const useChildren = (id: string | undefined) => useServerQuery(['children', id], (s) => api.children(s, id!), { enabled: !!id, staleTime: 30_000 });
|
||||
export const useChildren = (id: string | undefined) => useServerQuery(['children', id], (s) => api.children(s, id!), { enabled: !!id, staleTime: 30_000, ...WATCH_STATE });
|
||||
|
||||
export const useRelated = (id: string | undefined) => useServerQuery(['related', id], (s) => api.related(s, id!), { enabled: !!id, staleTime: 10 * 60_000 });
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ export interface Preferences {
|
|||
countdownSeconds: number;
|
||||
skipIntro: SkipMode;
|
||||
skipCredits: SkipMode;
|
||||
/** Seconds a "Skip automatically" marker waits, so it can be cancelled; 0 skips at once. */
|
||||
autoSkipDelay: number;
|
||||
watchedPercent: number;
|
||||
audioLanguage: string;
|
||||
subtitleMode: SubtitleMode;
|
||||
|
|
@ -62,6 +64,7 @@ export const defaults: Preferences = {
|
|||
countdownSeconds: 8,
|
||||
skipIntro: 'button',
|
||||
skipCredits: 'button',
|
||||
autoSkipDelay: 5,
|
||||
watchedPercent: 90,
|
||||
audioLanguage: '',
|
||||
subtitleMode: 'auto',
|
||||
|
|
|
|||
|
|
@ -492,36 +492,97 @@ function Volume() {
|
|||
);
|
||||
}
|
||||
|
||||
/** A seek that lands inside a marker this recently means the viewer chose to be there. */
|
||||
const SEEK_GRACE_MS = 1500;
|
||||
const MODIFIER_KEYS = new Set(['Shift', 'Control', 'Alt', 'Meta', 'AltGraph', 'CapsLock']);
|
||||
|
||||
/**
|
||||
* Skip intro / Skip credits. With "Skip automatically" the button counts down for the
|
||||
* chosen delay, filling as it goes, then skips. Pausing, seeking or pressing a key
|
||||
* before then keeps watching: the button stays as a plain skip for the rest of the marker.
|
||||
*/
|
||||
function SkipButton() {
|
||||
const item = usePlayer((s) => s.item);
|
||||
const position = usePlayer((s) => s.position);
|
||||
const seek = usePlayer((s) => s.seek);
|
||||
const nextUp = usePlayer((s) => s.nextUp);
|
||||
const countdown = usePlayer((s) => s.countdown);
|
||||
const paused = usePlayer((s) => s.paused);
|
||||
const ready = usePlayer((s) => s.firstFrame);
|
||||
const lastSeek = usePlayer((s) => s.lastSeek);
|
||||
const skipIntro = useSettings((s) => s.skipIntro);
|
||||
const skipCredits = useSettings((s) => s.skipCredits);
|
||||
const autoSkipped = useRef(new Set<string>());
|
||||
const delay = useSettings((s) => s.autoSkipDelay);
|
||||
// Markers already skipped, or whose automatic skip was cancelled, don't count down again.
|
||||
const settled = useRef(new Set<string>());
|
||||
const [pending, setPending] = useState<{ key: string; from: number } | null>(null);
|
||||
const ms = position * 1000;
|
||||
const marker = item?.markers.find((m) => (m.type === 'intro' || m.type === 'credits') && ms >= m.start && ms < m.end - 1000);
|
||||
const key = item && marker ? `${item.id}:${marker.type}:${marker.start}` : '';
|
||||
const mode = marker?.type === 'intro' ? skipIntro : skipCredits;
|
||||
const auto = !!marker && mode === 'auto' && !(marker.type === 'credits' && nextUp);
|
||||
const counting = pending && pending.key === key ? pending : null;
|
||||
|
||||
const skip = () => {
|
||||
if (!marker) return;
|
||||
settled.current.add(key);
|
||||
setPending(null);
|
||||
seek(marker.end / 1000);
|
||||
};
|
||||
const cancel = () => {
|
||||
if (!pending) return;
|
||||
settled.current.add(pending.key);
|
||||
setPending(null);
|
||||
};
|
||||
|
||||
// Start counting once an automatic marker is playing.
|
||||
useEffect(() => {
|
||||
if (marker && mode === 'auto' && !autoSkipped.current.has(marker.id + marker.start) && !(marker.type === 'credits' && nextUp)) {
|
||||
autoSkipped.current.add(marker.id + marker.start);
|
||||
seek(marker.end / 1000);
|
||||
if (!auto || !ready || paused || settled.current.has(key) || pending?.key === key) return;
|
||||
if (Date.now() - usePlayer.getState().lastSeek < SEEK_GRACE_MS) {
|
||||
settled.current.add(key);
|
||||
return;
|
||||
}
|
||||
}, [marker?.id, marker?.start, mode]);
|
||||
if (delay <= 0) return skip();
|
||||
setPending({ key, from: usePlayer.getState().position });
|
||||
}, [key, auto, ready, paused, delay]);
|
||||
|
||||
// Count playback time, so buffering doesn't eat into the delay.
|
||||
useEffect(() => {
|
||||
if (counting && position - counting.from >= delay) skip();
|
||||
else if (pending && !counting) setPending(null);
|
||||
}, [position, key]);
|
||||
|
||||
// Pausing or seeking means the viewer is watching.
|
||||
useEffect(() => {
|
||||
if (paused) cancel();
|
||||
}, [paused]);
|
||||
useEffect(cancel, [lastSeek]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!counting) return;
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (!MODIFIER_KEYS.has(e.key)) cancel();
|
||||
};
|
||||
window.addEventListener('keydown', onKey, true);
|
||||
return () => window.removeEventListener('keydown', onKey, true);
|
||||
}, [counting]);
|
||||
|
||||
if (!marker || mode === 'off' || countdown !== null) return null;
|
||||
if (marker.type === 'credits' && nextUp) return null;
|
||||
const what = marker.type === 'intro' ? 'intro' : 'credits';
|
||||
const elapsed = counting ? Math.max(0, position - counting.from) : 0;
|
||||
return (
|
||||
<button
|
||||
className="skip-button"
|
||||
className={`skip-button${counting ? ' counting' : ''}`}
|
||||
style={counting ? { ['--p' as string]: `${Math.min(1, elapsed / delay) * 100}%` } : undefined}
|
||||
title={counting ? 'Click to skip now. Pause, seek or press any key to keep watching.' : undefined}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
seek(marker.end / 1000);
|
||||
skip();
|
||||
}}
|
||||
onDoubleClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{marker.type === 'intro' ? 'Skip intro' : 'Skip credits'}
|
||||
<span>{counting ? `Skipping ${what}` : `Skip ${what}`}</span>
|
||||
<Icon name="skipNext" size={16} />
|
||||
</button>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ interface PlayerState {
|
|||
paused: boolean;
|
||||
buffering: boolean;
|
||||
seeking: boolean;
|
||||
/** When the last seek was asked for (Date.now()), so a pending auto-skip can step aside. */
|
||||
lastSeek: number;
|
||||
volume: number;
|
||||
muted: boolean;
|
||||
speed: number;
|
||||
|
|
@ -541,6 +543,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
|||
paused: false,
|
||||
buffering: false,
|
||||
seeking: false,
|
||||
lastSeek: 0,
|
||||
volume: 100,
|
||||
muted: false,
|
||||
speed: 1,
|
||||
|
|
@ -588,6 +591,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
|||
error: '',
|
||||
terminated: false,
|
||||
position: (opts.offsetMs ?? 0) / 1000,
|
||||
lastSeek: 0,
|
||||
duration: input.duration / 1000,
|
||||
cacheTime: 0,
|
||||
paused: false,
|
||||
|
|
@ -724,7 +728,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
|||
seek(seconds) {
|
||||
const st = get();
|
||||
const target = Math.max(0, Math.min(seconds, (st.duration || seconds) - 0.5));
|
||||
set({ position: target, ended: false });
|
||||
set({ position: target, ended: false, lastSeek: Date.now() });
|
||||
if (st.countdown !== null) {
|
||||
stopCountdown();
|
||||
set({ countdown: null });
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useMemo } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import * as api from '../plex/api';
|
||||
import { useSections, useServerQuery } from '../app/queries';
|
||||
import { PROGRESS, WATCH_STATE, useSections, useServerQuery } from '../app/queries';
|
||||
import { useServer } from '../app/session';
|
||||
import { navigate } from '../app/router';
|
||||
import { Hero } from '../ui/Hero';
|
||||
|
|
@ -14,8 +14,8 @@ export function Home() {
|
|||
const sections = useSections();
|
||||
const video = (sections.data ?? []).filter((s) => (s.type === 'movie' || s.type === 'show') && !s.hidden);
|
||||
|
||||
const home = useServerQuery(['homeHubs'], (s) => api.homeHubs(s));
|
||||
const continueWatching = useServerQuery(['continue'], (s) => api.continueWatching(s), { staleTime: 15_000 });
|
||||
const home = useServerQuery(['homeHubs'], (s) => api.homeHubs(s), WATCH_STATE);
|
||||
const continueWatching = useServerQuery(['continue'], (s) => api.continueWatching(s), PROGRESS);
|
||||
// Section hubs feed the hero and the release shelves; shared with Discover.
|
||||
const sectionHubs = useQuery({
|
||||
queryKey: [server.machineId, 'sectionHubsAll', video.map((s) => s.id).join(',')],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useEffect, useMemo, useState, type ReactNode } from 'react';
|
||||
import * as api from '../plex/api';
|
||||
import type { Item } from '../plex/types';
|
||||
import { useChildren, useItem, useRelated, useServerQuery } from '../app/queries';
|
||||
import { PROGRESS, useChildren, useItem, useRelated, useServerQuery } from '../app/queries';
|
||||
import { useServer } from '../app/session';
|
||||
import { useSettings } from '../app/settings';
|
||||
import { goBack, navigate, useRouter } from '../app/router';
|
||||
|
|
@ -401,7 +401,7 @@ function Episodes({ seasons, initialSeason, showPicker = true }: { seasons: Item
|
|||
function ShowDetail({ item }: { item: Item }) {
|
||||
const seasons = useChildren(item.id);
|
||||
const server = useServer();
|
||||
const next = useServerQuery(['onDeck', item.id], (s) => api.onDeckFor(s, item), { staleTime: 15_000 });
|
||||
const next = useServerQuery(['onDeck', item.id], (s) => api.onDeckFor(s, item), PROGRESS);
|
||||
const nextEp = next.data;
|
||||
const seasonList = (seasons.data ?? []).filter((s) => s.type === 'season');
|
||||
const percent = useSettings((s) => s.watchedPercent);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useMemo } from 'react';
|
||||
import * as api from '../plex/api';
|
||||
import { useSectionFor, useServerQuery } from '../app/queries';
|
||||
import { PROGRESS, useSectionFor, useServerQuery } from '../app/queries';
|
||||
import { navigate, useRouter, type SectionKind, type SectionTab } from '../app/router';
|
||||
import { useSettings } from '../app/settings';
|
||||
import type { Section } from '../plex/types';
|
||||
|
|
@ -46,7 +46,7 @@ function SectionHeader({ kind, tab, section, all, overlay }: { kind: SectionKind
|
|||
|
||||
function Discover({ kind, section }: { kind: SectionKind; section: Section }) {
|
||||
const hubs = useServerQuery(['sectionHubs', section.id], (s) => api.sectionHubs(s, section.id));
|
||||
const cw = useServerQuery(['continue', section.id], (s) => api.continueWatching(s, section.id), { staleTime: 15_000 });
|
||||
const cw = useServerQuery(['continue', section.id], (s) => api.continueWatching(s, section.id), PROGRESS);
|
||||
const seasons = useServerQuery(['recentSeasons', section.id], (s) => recentSeasons(s, section.id), { enabled: kind === 'show', staleTime: 120_000 });
|
||||
const features = useMemo(() => buildFeatures(hubs.data ?? [], 7, kind === 'movie' ? 1 : 2), [hubs.data, kind]);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,14 @@ export function AppSettings({ tab }: { tab: string }) {
|
|||
<Pref label="Skip credits">
|
||||
<Select value={s.skipCredits} onChange={(v) => set('skipCredits', v)} options={skipOptions} />
|
||||
</Pref>
|
||||
<Pref label="Automatic skip delay" description="How long the button counts down before skipping automatically. Pause, seek or press any key to keep watching instead.">
|
||||
<Select
|
||||
value={s.autoSkipDelay}
|
||||
disabled={s.skipIntro !== 'auto' && s.skipCredits !== 'auto'}
|
||||
onChange={(v) => set('autoSkipDelay', v)}
|
||||
options={[0, 3, 5, 10].map((v) => ({ value: v, label: v ? `${v} seconds` : 'Skip straight away' }))}
|
||||
/>
|
||||
</Pref>
|
||||
<Pref label="Play the next episode automatically">
|
||||
<Switch checked={s.autoplayNext} onChange={(v) => set('autoplayNext', v)} />
|
||||
</Pref>
|
||||
|
|
|
|||
|
|
@ -687,6 +687,24 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
|||
background: #f3f5f4;
|
||||
color: #111;
|
||||
}
|
||||
/* An automatic skip fills the button as it counts down. */
|
||||
.skip-button.counting {
|
||||
overflow: hidden;
|
||||
}
|
||||
.skip-button.counting::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0 auto 0 0;
|
||||
width: var(--p, 0%);
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
transition: width 260ms linear;
|
||||
}
|
||||
.skip-button.counting:hover::before {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.skip-button > * {
|
||||
position: relative;
|
||||
}
|
||||
.post-play {
|
||||
position: absolute;
|
||||
right: clamp(24px, 3.5vw, 56px);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue