Compare commits

..
Author SHA1 Message Date
spark e80cbaf388 feat(mcp): open the PhotoReport window from the assistant
ci / rust (pull_request) Successful in 7m20s
ci / typescript (pull_request) Successful in 12m56s
photoreport_show brings the app forward and tells the signed-in window which module, event, photo and tool to open.
2026-11-07 03:12:36 +00:00
14 changed files with 27 additions and 261 deletions

No files matched your search

+7 -34
View File
@@ -1,8 +1,7 @@
/**
* "Only the best" (docs/photo-editing-rules.md §5): for clients that want a short gallery of the match, not every
* usable frame. The match is cut into short windows, and each window may add its share of the gallery size, with
* the share it did not use carried forward (half-time adds nothing, a busy spell may take a little more).
* The asked size is a target: a rich match may pass it by about 15% (never more than 25 frames); a thin one stays under. Within a
* the share it did not use carried forward (half-time adds nothing, a busy spell may take a little more). Within a
* window the frames with the most action win: the ball in play, a duel or a celebration, a subject big in the
* frame and sharp; one frame per burst, and not two from the same few seconds. Anything well below the match's
* typical frame is left out even when the window has room.
@@ -66,15 +65,6 @@ const median = (xs: number[]) => {
return s[Math.floor(s.length / 2)]!;
};
/**
* How many frames a gallery may reach. The asked size is the target: about 15% more when the match is rich,
* at least 2 and never more than 25 past it, so a short gallery stays close and a long one can breathe.
*/
export function galleryCeiling(count: number): number {
const extra = Math.min(25, Math.max(2, Math.round(count * 0.15)));
return count + extra;
}
/**
* Decides the windows that have closed and are not decided yet. `decided` holds the candidates already decided
* (chosen or not), so earlier choices count against the gallery size.
@@ -85,14 +75,11 @@ export function curate(candidates: Candidate[], decided: { id: string; chosen: b
const settleMs = opts.settleMs ?? 60_000;
const done = new Map(decided.map((d) => [d.id, d.chosen]));
let chosenSoFar = [...done.values()].filter(Boolean).length;
const cap = galleryCeiling(opts.count);
const cap = Math.round(opts.count * 1.1);
const perWindow = (opts.count * windowMs) / opts.durationMs;
const windows = Math.max(1, opts.durationMs / windowMs);
// The match's typical frame. The floor drops weak frames; only a frame at or above the typical one may use the slack.
// The match's typical frame, for the floor: half of the median of the frames with a subject.
const scored = candidates.map((c) => ({ c, s: actionScore(c) }));
const positives = scored.filter((x) => x.s > 0).map((x) => x.s);
const typical = positives.length >= 10 ? median(positives) : Number.POSITIVE_INFINITY;
const floor = positives.length >= 10 ? 0.5 * typical : 0;
const floor = scored.filter((x) => x.s > 0).length >= 10 ? 0.5 * median(scored.filter((x) => x.s > 0).map((x) => x.s)) : 0;
const byWindow = new Map<number, typeof scored>();
for (const x of scored) {
@@ -111,29 +98,15 @@ export function curate(candidates: Candidate[], decided: { id: string; chosen: b
const end = opts.start + (w + 1) * windowMs;
if (end + settleMs > opts.now) break;
// The share up to the end of this window, minus what was already chosen; at most three windows' worth at once.
const target = Math.min(opts.count, Math.round(perWindow * (w + 1)));
const room = Math.max(0, Math.min(target - chosenSoFar, Math.ceil(3 * perWindow), opts.count - chosenSoFar));
const target = Math.min(cap, Math.round(perWindow * (w + 1)));
const room = Math.max(0, Math.min(target - chosenSoFar, Math.ceil(3 * perWindow), cap - chosenSoFar));
const ranked = list.filter((x) => x.s > 0 && x.s >= floor).sort((a, b) => b.s - a.s);
const chosen: Candidate[] = [];
const fits = (c: Candidate) => !chosen.some((o) => o.burst === c.burst || Math.abs(o.at - c.at) < minGapMs);
for (const { c } of ranked) {
if (chosen.length >= room) break;
if (!fits(c)) continue;
if (chosen.some((o) => o.burst === c.burst || Math.abs(o.at - c.at) < minGapMs)) continue;
chosen.push(c);
}
// Slack follows the match, about 15% by the end. A quiet spell leaves it; a rich window may spend up to two frames of it.
const slackByNow = Math.round(((cap - opts.count) * (w + 1)) / windows);
const alreadyOver = Math.max(0, chosenSoFar - opts.count);
let extraLeft = Math.min(2, Math.max(0, slackByNow - alreadyOver), cap - chosenSoFar - chosen.length);
if (extraLeft > 0 && typical !== Number.POSITIVE_INFINITY) {
for (const { c, s } of ranked) {
if (extraLeft <= 0) break;
if (chosen.includes(c)) continue;
if (s < typical || !fits(c)) continue;
chosen.push(c);
extraLeft -= 1;
}
}
chosenSoFar += chosen.length;
out.push({ window: w, ids: list.map((x) => x.c.id), chosen: chosen.sort((a, b) => a.at - b.at).map((c) => c.id) });
}
+5 -80
View File
@@ -20,7 +20,7 @@ import { bestOf, FOCUS_SHARP, groupBursts, reportagePickCount } from "./bursts.j
import { curate, matchMinutes } from "./curate.js";
import { type LearntStyle, learntStyle } from "./learning.js";
import { detailForCrop, lookValues } from "./look.js";
import { exportTargets, galleryReceivers, MELHORES_GAP_MS, picksNeeded, type GalleryExport } from "./targets.js";
import { exportTargets, MELHORES_GAP_MS, picksNeeded } from "./targets.js";
const STALE_RUNNING_MS = 10 * 60_000;
/** A burst is decided once no new frame of it has arrived for this long. */
@@ -63,8 +63,6 @@ export interface AutopilotRecord {
chosen?: boolean;
/** "ball": the picture cuts the ball, so it is not delivered. */
hold?: "ball";
/** Per destination gallery: true when this frame was picked for it, false when its window decided against it. */
gallery?: Record<string, boolean>;
/**
* Planned develop/crop ops from analysis. Applied only when this frame is picked for the burst — never on the
* near-duplicates left unflagged.
@@ -376,42 +374,15 @@ export class AutopilotService {
.filter((p) => (p.autopilot as unknown as AutopilotRecord | null)?.curated)
.map((p) => ({ id: p.id, chosen: !!(p.autopilot as unknown as AutopilotRecord).chosen }));
const targets = exportTargets(settings);
const galleries = settings.galleries ?? [];
// With 2+ exports, curate on the best frame; delivery below assigns best/2nd/… to each target.
// Separate gallery sizes curate to the largest, and each smaller one keeps its own spread.
const candidates = candidatesOf(ranked, settings.burstGapSec * 1000, true, "best");
const curateOpts = {
const decisions = curate(candidates, decided, {
count: settings.bestCount,
start: event.startsAt.getTime(),
durationMs: matchMinutes(event.sport) * 60_000,
now: now.getTime(),
minGapMs: MELHORES_GAP_MS,
};
const decisions = curate(candidates, decided, {
count: galleries.length ? Math.max(...galleries.map((g) => g.count)) : settings.bestCount,
...curateOpts,
});
const chosenBy = new Map<string, Set<string>>();
const seenBy = new Map<string, Set<string>>();
if (galleries.length) {
const max = Math.max(...galleries.map((g) => g.count));
const bigChosen = new Set(decisions.flatMap((d) => d.chosen));
const bigSeen = new Set(decisions.flatMap((d) => d.ids));
for (const g of galleries) {
if (g.count !== max) continue;
chosenBy.set(g.targetId, bigChosen);
seenBy.set(g.targetId, bigSeen);
}
for (const g of galleries) {
if (g.count === max) continue;
const earlier = photos.flatMap((p) => {
const flag = (p.autopilot as unknown as AutopilotRecord | null)?.gallery?.[g.targetId];
return flag === undefined ? [] : [{ id: p.id, chosen: flag }];
});
const parts = curate(candidates, earlier, { count: g.count, ...curateOpts });
chosenBy.set(g.targetId, new Set(parts.flatMap((d) => d.chosen)));
seenBy.set(g.targetId, new Set(parts.flatMap((d) => d.ids)));
}
}
const records = new Map(photos.map((p) => [p.id, p.autopilot as unknown as AutopilotRecord | null]));
// Frames that were not their burst's candidate are decided with it.
const burstOf = new Map<string, string[]>();
@@ -429,13 +400,12 @@ export class AutopilotService {
for (const id of ids) {
const rec = records.get(id);
if (!rec || rec.curated) continue;
const gallery = galleryMarks(id, galleries, chosenBy, seenBy, rec.gallery);
await db.photo.update({ where: { id }, data: { autopilot: { ...rec, curated: true, chosen: chosen.has(id), ...(gallery ? { gallery } : {}) } as object } });
await db.photo.update({ where: { id }, data: { autopilot: { ...rec, curated: true, chosen: chosen.has(id) } as object } });
nowCurated.push(id);
}
const when = new Map(photos.map((p) => [p.id, p.capturedAt]));
chosenCount += chosen.size;
if (!galleries.length && targets.length && this.deps.deliveries && event.createdById) {
if (targets.length && this.deps.deliveries && event.createdById) {
// Per chosen moment (burst): rank i → export i. Same photo never to two destinations.
for (const momentId of chosen) {
const burstIds = burstOf.get(momentId) ?? [momentId];
@@ -457,33 +427,6 @@ export class AutopilotService {
}
if (d.window >= 0) log.info({ eventId, window: d.window, candidates: d.ids.length, chosen: chosen.size }, "autopilot: best of the window");
}
if (galleries.length && this.deps.deliveries && event.createdById) {
const when = new Map(photos.map((p) => [p.id, p.capturedAt]));
const moments = new Set<string>();
for (const [targetId, picked] of chosenBy) {
const seen = seenBy.get(targetId);
for (const id of picked) if (seen?.has(id)) moments.add(id);
}
for (const momentId of moments) {
if (!takenHere([momentId], when, event).length) continue;
for (const targetId of galleryReceivers(momentId, galleries, chosenBy)) {
await this.deps.deliveries
.enqueue({ organizationId: event.organizationId, targetId, photoIds: [momentId], again: false, requestedById: event.createdById })
.catch((err: unknown) => log.warn({ err, targetId }, "autopilot: delivery not queued"));
}
}
// Windows already closed before these galleries existed still need their decision recorded.
for (const [targetId, seen] of seenBy) {
for (const id of seen) {
const rec = records.get(id);
if (!rec?.curated || rec.gallery?.[targetId] !== undefined) continue;
const gallery = galleryMarks(id, galleries, chosenBy, seenBy, rec.gallery);
if (!gallery) continue;
rec.gallery = gallery;
await db.photo.update({ where: { id }, data: { autopilot: { ...rec, gallery } as object } });
}
}
}
return chosenCount;
}
}
@@ -492,24 +435,6 @@ export class AutopilotService {
* The photos of a decided window that go to the second client: the picked ones (by the autopilot or a person) the
* gallery did not take. Never a chosen one, so no photo reaches both clients.
*/
/** Gallery flags for a frame whose window was decided this pass. Unmentioned destinations stay as they were. */
function galleryMarks(
id: string,
galleries: readonly GalleryExport[],
chosenBy: ReadonlyMap<string, ReadonlySet<string>>,
seenBy: ReadonlyMap<string, ReadonlySet<string>>,
previous: Record<string, boolean> | undefined,
): Record<string, boolean> | undefined {
const flags: Record<string, boolean> = { ...previous };
let touched = false;
for (const g of galleries) {
if (!seenBy.get(g.targetId)?.has(id)) continue;
flags[g.targetId] = chosenBy.get(g.targetId)?.has(id) ?? false;
touched = true;
}
return touched ? flags : undefined;
}
export function restOf(ids: readonly string[], chosen: ReadonlySet<string>, flags: ReadonlyMap<string, string>): string[] {
return ids.filter((id) => !chosen.has(id) && flags.get(id) === "PICK");
}
-20
View File
@@ -31,23 +31,3 @@ export function picksNeeded(settings: AutopilotSettings): number {
/** Melhores spacing between two sends to the same destination (ms). */
export const MELHORES_GAP_MS = 5_000;
export interface GalleryExport {
targetId: string;
count: number;
}
/**
* Destinations that receive this frame. A frame picked for a smaller gallery also goes to every larger one,
* so the short gallery is part of the long one. A frame only the long gallery picked stays out of the short one.
*/
export function galleryReceivers(momentId: string, galleries: readonly GalleryExport[], chosen: ReadonlyMap<string, ReadonlySet<string>>): string[] {
if (!galleries.length) return [];
const max = Math.max(...galleries.map((g) => g.count));
const hit = galleries.filter((g) => chosen.get(g.targetId)?.has(momentId));
const ids = new Set(hit.map((g) => g.targetId));
if (hit.some((g) => g.count < max)) {
for (const g of galleries) if (g.count === max) ids.add(g.targetId);
}
return [...ids];
}
+2 -2
View File
@@ -591,8 +591,8 @@ export class DeliveryService {
}
const client = this.client(item.target);
await client.ensureFolder(folder);
// ZeroZero's Autor / Fotógrafo is this whole line ("Peter Spark / Kapta+"), not only the name before the slash.
const creator = typeof iptc?.values.creator === "string" ? iptc.values.creator.trim() : "";
// The author as the service shows it: the photographer's name from the IPTC creator ("Peter Spark / PhotoReport.pt").
const creator = typeof iptc?.values.creator === "string" ? iptc.values.creator.split(" / ")[0]!.trim() : "";
const remote = await client.upload(folder + fileName, data, { author: creator || item.photo.uploader?.name || undefined });
const remotePath = typeof remote === "string" ? remote : folder + fileName;
// "synced-…" means the desk already had this file, so this attempt did not put a new image up.
+1 -11
View File
@@ -15,16 +15,6 @@ import { splitStoredPlace } from "../sports/providers.js";
import { claimInbox } from "./adopt.js";
const HOUR = 3600_000;
/** An older app does not send `galleries`. Keep the sizes already stored instead of clearing them. */
function keptGalleries(next: AutopilotSettings | null, current: Prisma.JsonValue): AutopilotSettings | typeof Prisma.DbNull {
if (!next) return Prisma.DbNull;
if (next.galleries !== undefined) return next;
if (!current || typeof current !== "object" || Array.isArray(current)) return next;
const kept = (current as { galleries?: AutopilotSettings["galleries"] }).galleries;
if (!Array.isArray(kept) || kept.length === 0) return next;
return { ...next, galleries: kept };
}
const OrgParams = z.object({ orgId: z.uuid() });
const EventParams = z.object({ eventId: z.uuid() });
@@ -252,7 +242,7 @@ export async function registerEventRoutes(app: FastifyInstance, deps: { db: Db;
...(startsAt && { startsAt }),
...window,
...(iptcTemplate && { iptcTemplate }),
...(autopilot !== undefined && { autopilot: keptGalleries(autopilot, current.autopilot) }),
...(autopilot !== undefined && { autopilot: autopilot ?? Prisma.DbNull }),
...(archived !== undefined && { archivedAt: archived ? (current.archivedAt ?? new Date()) : null }),
},
include,
+2 -5
View File
@@ -5,7 +5,7 @@ import sharp from "sharp";
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { AutopilotService } from "../src/autopilot/service.js";
import { bestOf, groupBursts, reportagePickCount } from "../src/autopilot/bursts.js";
import { type Candidate, actionScore, curate, galleryCeiling } from "../src/autopilot/curate.js";
import { type Candidate, actionScore, curate } from "../src/autopilot/curate.js";
import { correctionOf, fold, learntStyle, recordCorrection, styleOf } from "../src/autopilot/learning.js";
import type { Detections } from "../src/composition/compose.js";
import type { SubjectDetector } from "../src/composition/detect.js";
@@ -103,10 +103,7 @@ describe("only the best", () => {
const opts = { count: 30, start, durationMs: 105 * min, now: start + 200 * min };
const all = curate(frames, [], opts).flatMap((d) => d.chosen);
expect(all.length).toBeGreaterThanOrEqual(28);
expect(all.length).toBeLessThanOrEqual(galleryCeiling(30));
expect(galleryCeiling(30)).toBe(35);
expect(galleryCeiling(100)).toBe(115);
expect(galleryCeiling(300)).toBe(325);
expect(all.length).toBeLessThanOrEqual(33);
expect(all).toContain(great.id);
expect(all).not.toContain(twin.id);
expect(all).not.toContain(rejected.id);
+2 -2
View File
@@ -585,7 +585,7 @@ describe("delivery", () => {
method: "POST",
url: `/v1/orgs/${orgId}/delivery-targets`,
headers: bearer(token),
payload: { name: "ZeroZero", kind: "ZEROZERO", baseUrl: "https://fotos.zerozero.pt", username: "kapta", password: "zz-pass", folderTemplate: "zerozero", fileNameTemplate: "PS_{home} x {away}_{n}.jpg", longEdge: 3000, jpegQuality: 92, iptcOverrides: { creator: "Peter Spark / Kapta+", credit: "Peter Spark / Kapta+", copyright: "Peter Spark / Kapta+", source: "Peter Spark / Kapta+" } },
payload: { name: "ZeroZero", kind: "ZEROZERO", baseUrl: "https://fotos.zerozero.pt", username: "kapta", password: "zz-pass", folderTemplate: "zerozero", fileNameTemplate: "PS_{home} x {away}_{n}.jpg", longEdge: 3000, jpegQuality: 92 },
});
expect(created.statusCode).toBe(201);
const targetId = (created.json() as { id: string }).id;
@@ -619,7 +619,7 @@ describe("delivery", () => {
expect(items.map((i) => i.remotePath).sort()).toEqual(["12627747/img-1", "12627747/img-2"]);
expect((await ctx.db.event.findUniqueOrThrow({ where: { id: event.id } })).zerozeroGameId).toBe("12627747");
const first = [...zz.uploads.values()].find((u) => u.meta.filename?.endsWith("_1.jpg"))!;
expect(first.meta).toMatchObject({ match_id: "12627747", artist: "Peter Spark / Kapta+", filename: "PS_SC Torreense x Sunderland_1.jpg", filetype: "image/jpeg" });
expect(first.meta).toMatchObject({ match_id: "12627747", artist: "Peter Spark", filename: "PS_SC Torreense x Sunderland_1.jpg", filetype: "image/jpeg" });
expect(first.data.length).toBe(first.length);
expect((await sharp(first.data).metadata()).width).toBe(3000);
// Signed in once for the whole batch.
+1 -27
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { AutopilotSettings } from "@photoreport/contracts";
import { exportTargets, galleryReceivers, picksNeeded } from "../src/autopilot/targets.js";
import { exportTargets, picksNeeded } from "../src/autopilot/targets.js";
const a = "11111111-1111-4111-8111-111111111111";
const b = "22222222-2222-4222-8222-222222222222";
@@ -27,29 +27,3 @@ describe("picksNeeded", () => {
expect(picksNeeded(AutopilotSettings.parse({ enabled: true, picksPerBurst: 2 }))).toBe(2);
});
});
describe("galleryReceivers", () => {
const zz = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
const liga = "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb";
const galleries = [
{ targetId: zz, count: 30 },
{ targetId: liga, count: 100 },
];
it("sends a short-gallery frame to the short client and to the larger one", () => {
const chosen = new Map<string, Set<string>>([
[zz, new Set(["p1"])],
[liga, new Set(["p1", "p2"])],
]);
expect(galleryReceivers("p1", galleries, chosen).sort()).toEqual([liga, zz].sort());
expect(galleryReceivers("p2", galleries, chosen)).toEqual([liga]);
});
it("puts a frame only the short gallery picked into the larger gallery too", () => {
const chosen = new Map<string, Set<string>>([
[zz, new Set(["p1"])],
[liga, new Set()],
]);
expect(galleryReceivers("p1", galleries, chosen).sort()).toEqual([liga, zz].sort());
});
});
+1 -1
View File
@@ -562,7 +562,7 @@ export const t = {
selectionBursts: "As escolhidas de cada sequência",
selectionBest: "Só as melhores do jogo",
bestCount: "Fotos na galeria (aprox.)",
bestHelp: "Uma galeria curta de momentos de jogo: bola em jogo, duelos e festejos, jogadores grandes e nítidos no enquadramento, espalhados pelo jogo (a cada 5 minutos entram as melhores desse período). O número é a meta: num jogo rico pode ir um pouco acima (cerca de 15%, nunca mais de 25 fotos), num jogo fraco fica aquém. Numa sequência fica a de frente e com os olhos abertos, quando dá para distinguir. Aquecimento e intervalo ficam de fora; as fotos com estrelas têm prioridade e as rejeitadas nunca vão.",
bestHelp: "Uma galeria curta de momentos de jogo: bola em jogo, duelos e festejos, jogadores grandes e nítidos no enquadramento, espalhados pelo jogo (a cada 5 minutos entram as melhores desse período). Numa sequência fica a de frente e com os olhos abertos, quando dá para distinguir. Aquecimento e intervalo ficam de fora; as fotos com estrelas têm prioridade e as rejeitadas nunca vão.",
restTarget: "As outras escolhidas para",
restHelp:
"Cada foto vai só para um cliente. A galeria acima leva a segunda melhor de cada sequência escolhida; todas as outras escolhidas seguem para aqui quando fecha cada período de 5 minutos.",
-51
View File
@@ -1,51 +0,0 @@
import type { PhotoSummary } from "@photoreport/contracts";
import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { Grid } from "./Grid.js";
function photo(id: string): PhotoSummary {
return {
id,
eventId: "e1",
originalName: `${id}.jpg`,
name: `${id}.jpg`,
sha256: `sha-${id}`,
originalStored: true,
status: "READY",
width: 600,
height: 400,
capturedAt: "2026-09-23T20:00:00Z",
cameraModel: null,
lens: null,
focalLength: null,
aperture: null,
exposureTime: null,
iso: null,
rating: 0,
flag: "NONE",
colorLabel: "NONE",
players: [],
uploader: null,
developSeq: 0,
urls: { thumb: "", preview: "", source: "" },
};
}
describe("grid", () => {
it("opens the photo on a double-click", () => {
const onOpen = vi.fn();
render(
<Grid
photos={[photo("a")]}
selected={new Set()}
focus={null}
srcFor={() => ""}
onPick={() => {}}
onSelectMany={() => {}}
onOpen={onOpen}
/>,
);
fireEvent.doubleClick(screen.getByRole("button", { name: /a\.jpg/ }));
expect(onOpen).toHaveBeenCalledWith("a");
});
});
+4 -9
View File
@@ -171,8 +171,6 @@ export function Grid(props: {
const dy = e.clientY - current.y;
if (!current.moved && Math.hypot(dx, dy) < DRAG_PX) return;
current.moved = true;
// Capture only once the drag is real. Capturing on the first press steals the second click, so a double-click never opens the photo.
if (!section.hasPointerCapture(e.pointerId)) section.setPointerCapture(e.pointerId);
const left = Math.min(current.x, e.clientX);
const top = Math.min(current.y, e.clientY);
const width = Math.abs(e.clientX - current.x);
@@ -199,6 +197,7 @@ export function Grid(props: {
base: [...props.selected],
moved: false,
};
e.currentTarget.setPointerCapture(e.pointerId);
}}
onPointerMove={moveBand}
onPointerUp={(e) => {
@@ -257,7 +256,6 @@ export function Loupe({
total,
faces = [],
onMenu,
onClose,
}: {
photo: PhotoSummary;
src: string;
@@ -266,8 +264,6 @@ export function Loupe({
total: number;
faces?: LoupeFace[];
onMenu?: (id: string, e: React.MouseEvent) => void;
/** Double-click returns to the grid. */
onClose?: () => void;
}) {
// Desktop app: previews seen once show again without a network; never seen, the thumbnail stands in.
const preview = useCachedImage(src, isDesktop());
@@ -292,8 +288,7 @@ export function Loupe({
return (
<section
aria-label="Lupa"
className="relative flex h-full min-h-0 flex-1 items-center justify-center bg-[#121213]"
onDoubleClick={() => onClose?.()}
className="relative flex h-full min-h-[420px] items-center justify-center bg-[#121213] p-6"
onContextMenu={(e) => {
if (!onMenu) {
e.preventDefault();
@@ -303,13 +298,13 @@ export function Loupe({
onMenu(photo.id, e);
}}
>
<span className="relative flex h-full max-h-full w-full items-center justify-center">
<span className="relative inline-block max-h-full max-w-full">
<img
src={shown}
onError={() => setFailed(true)}
alt={photo.name}
draggable={false}
className="pointer-events-none block max-h-full max-w-full object-contain"
className="pointer-events-none block max-h-[calc(100vh-14rem)] max-w-full object-contain shadow-[0_2px_12px_rgba(0,0,0,0.7)]"
/>
{softCrop && <SoftCropGuide crop={softCrop} />}
{faces.map((f) => (
+1 -2
View File
@@ -777,7 +777,7 @@ export function LibraryPage() {
)}
<div
className={`min-h-0 flex-1 ${sheet || loupe ? "flex flex-col overflow-hidden" : "overflow-y-auto"} ${dragging ? "outline outline-2 -outline-offset-4 outline-accent" : ""}`}
className={`min-h-0 flex-1 ${sheet ? "flex flex-col overflow-hidden" : "overflow-y-auto"} ${dragging ? "outline outline-2 -outline-offset-4 outline-accent" : ""}`}
onDragOver={(e) => {
if (!e.dataTransfer.types.includes("Files")) return;
e.preventDefault();
@@ -884,7 +884,6 @@ export function LibraryPage() {
index={visibleIds.indexOf(focus.id)}
total={visibleIds.length}
faces={loupeFaces}
onClose={() => setLoupe(false)}
{...(canCull ? { onMenu: onPhotoMenu } : {})}
/>
) : visible.length || suggested.length ? (
+1 -3
View File
@@ -168,9 +168,7 @@ With autopilot "only the best", windows still shape the first pass (`apps/api/sr
- the match (from kick-off, its typical length by sport: football 115 min with the break, handball 80) is cut
into 5-minute windows; each window may add its share of the gallery, and a share it did not use (the break,
a quiet spell) carries forward, at most three windows' worth at once. The size is a target (`galleryCeiling`):
a rich match may add about 15% (at least 2 frames, never more than 25 past the number) from frames at or above
the match's typical one; a thin match stays under;
a quiet spell) carries forward, at most three windows' worth at once; at most 10% over the size in all;
- one candidate per burst (its best frame), ranked by game moment: the frame score, more with the ball in play
(×1.3), a duel or a celebration (several people in the subject), less when the subject is small (far away);
the photographer's stars count (+20% each), a rejected frame never goes;
-14
View File
@@ -69,20 +69,6 @@ export const AutopilotSettings = z.object({
*/
selection: z.enum(["bursts", "best"]).default("bursts"),
bestCount: z.number().int().min(5).max(300).default(30),
/**
* One gallery size per destination ("only the best"). The match is spread to the largest count; a smaller
* gallery receives its own spread, and those frames also go to every larger gallery. Empty: every destination
* shares `bestCount`, one frame of each burst each.
*/
galleries: z
.array(
z.object({
targetId: z.string().uuid(),
count: z.number().int().min(5).max(300),
}),
)
.max(10)
.optional(),
/**
* Legacy second export. With two destinations, each burst's best goes to `deliverTargetId` and the second best
* to this one when `deliverTargetIds` is empty. Prefer `deliverTargetIds`.