Le schermate 15–21 dell'esportazione sono rifatte con i formati della tappa E3 (la 15 intera, fino a «Conversione della libreria»), e se ne aggiungono sei: finestra «Fotogrammi» dal visualizzatore (istante con anteprima; «N in tutto» con la striscia, JPG «con perdita» e la cartella delle copie), «Fotogrammi…» dalla selezione, righe delle copie con il fotogramma nel visualizzatore, «Copia in…» con «Cambia» aperto e la domanda della conversione della libreria. Nuovi passi del programma delle schermate; nessuno converte, scarica o copia. Il confronto con i mockup è in docs/schermate/differenze.md, con i limiti della dimostrazione. Ritocchi trovati nel confronto: la riga «Fotogramma a …» ora è centrata sul campo dell'istante, le note sotto «Formato» non hanno più 12 px in più, e in «Copia in…» le etichette Foto e Video stanno sopra i controlli, che così sono allineati. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
2.0 KiB
JavaScript
34 lines
2.0 KiB
JavaScript
// The viewer of the video the demo has a frame of (spec §4.6, §4.10, tappa E3; composed from mockup 02): in the File
|
|
// panel the copy rows with their form, «Copiato in Disco USB … · intero» and «… · fotogramma a 0:01,125 · PNG», and
|
|
// «Fotogramma» among the actions at the bottom.
|
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
const until = async (test, tries = 100) => { for (let i = 0; i < tries && !test(); i++) await sleep(100); return test(); };
|
|
const json = (path) => fetch(path, { headers: { Accept: 'application/json' } }).then((r) => r.json());
|
|
|
|
const marta = (await json('/api/accounts')).accounts.find((a) => a.username === 'marta.demo');
|
|
const videos = [];
|
|
for (let cursor = null, i = 0; i < 20; i++) {
|
|
const page = await json(`/api/library?accounts=${marta.id}&mode=files&limit=600${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}`);
|
|
videos.push(...page.tiles.filter((x) => x.cover && x.cover.kind === 'video'));
|
|
if (!(cursor = page.older)) break;
|
|
}
|
|
let found = null;
|
|
for (let i = 0; i < videos.length && !found; i += 16) {
|
|
const entries = await Promise.all(videos.slice(i, i + 16).map((x) => json(`/api/entries/${x.id}`)));
|
|
found = entries.find((e) => e.media.some((m) => (m.copies || []).some((c) => c.variant === 'frame')));
|
|
}
|
|
const { navigate } = await import('/js/core/shell.js');
|
|
await navigate(`/libreria?account=${found.account.id}&dal=${found.publishedDay}&al=${found.publishedDay}`);
|
|
const tile = () => document.querySelector(`.mosaico .tess[data-entry="${found.id}"]`);
|
|
await until(tile);
|
|
tile().click();
|
|
await until(() => document.querySelector('.vis .azione-fotogramma') && document.querySelectorAll('.vis .riga-copia').length >= 2
|
|
&& document.querySelector('.vis video')?.readyState >= 2);
|
|
const video = document.querySelector('.vis video');
|
|
video.pause();
|
|
video.currentTime = 1.125;
|
|
await until(() => !video.seeking, 50);
|
|
await sleep(600);
|
|
document.activeElement?.blur();
|
|
return [...document.querySelectorAll('.vis .riga-copia')].map((r) => r.textContent);
|