E4: dimostrazione e passi delle schermate che reggono a ogni ora

Quale video sia fermo dipende dall'ora: i passi lo cercano in tutta la libreria e dicono se manca. La dimostrazione
chiude la ricerca prima dell'archivio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 18:57:59 +01:00
1 parent 2c0cfcccf2
commit 18d8b70638
6 files changed
+69 -33

No files matched your search

@@ -5,20 +5,30 @@ const until = async (test, tries = 100) => { for (let i = 0; i < tries && !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 tiles = (await json(`/api/library?accounts=${marta.id}&kind=videos&limit=100`)).tiles;
let found = null;
for (const x of tiles) {
const entry = await json(`/api/entries/${x.id}`);
if (entry.media.length === 1 && entry.media[0].available && !entry.media[0].still && entry.media[0].framesAvailable) {
found = entry;
break;
}
// Which video it is depends on the day and the hour of the demo: every file of the account, also inside a series.
const videos = [];
for (let cursor = null, i = 0; i < 40; 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;
}
const wanted = (m) => m.kind === 'video' && m.available && m.framesAvailable && !m.still;
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(wanted));
}
if (!found) throw new Error('La dimostrazione non ha un video di @marta.demo mai analizzato.');
const { navigate } = await import('/js/core/shell.js');
await navigate(`/libreria?account=${marta.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 .riga-file, .vis video, .vis img'));
for (let i = found.media.findIndex(wanted); i > 0; i--) {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight' }));
await sleep(300);
}
await until(() => document.querySelector('.vis .azione-video-fermo') && document.querySelector('.vis video')?.readyState >= 2);
const video = document.querySelector('.vis video');
video.pause();
@@ -5,20 +5,30 @@ const until = async (test, tries = 100) => { for (let i = 0; i < tries && !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 tiles = (await json(`/api/library?accounts=${marta.id}&kind=videos&limit=100`)).tiles;
let found = null;
for (const x of tiles) {
const entry = await json(`/api/entries/${x.id}`);
if (entry.media[0].still?.outcome === 'notAnalyzable') {
found = entry;
break;
}
// Which video it is depends on the day and the hour of the demo: every file of the account, also inside a series.
const videos = [];
for (let cursor = null, i = 0; i < 40; 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;
}
const wanted = (m) => m.still?.outcome === 'notAnalyzable';
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(wanted));
}
if (!found) throw new Error('La dimostrazione non ha un video di @marta.demo «Non analizzabile».');
const { navigate } = await import('/js/core/shell.js');
await navigate(`/libreria?account=${marta.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 .riga-file, .vis video, .vis img'));
for (let i = found.media.findIndex(wanted); i > 0; i--) {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight' }));
await sleep(300);
}
await until(() => document.querySelector('.vis .analizza-di-nuovo') && document.querySelector('.vis video')?.readyState >= 2);
const video = document.querySelector('.vis video');
video.pause();
@@ -7,9 +7,16 @@ const json = (path) => fetch(path, { headers: { Accept: 'application/json' } }).
const marta = (await json('/api/accounts')).accounts.find((a) => a.username === 'marta.demo');
const still = (await json(`/api/library?kind=stillvideos&accounts=${marta.id}&limit=1`)).tiles[0];
if (!still) throw new Error('La dimostrazione non ha un video fermo di @marta.demo.');
const tile = () => document.querySelector(`.mosaico .tess[data-entry="${still.id}"]`);
await until(tile);
tile().click();
const entry = await json(`/api/entries/${still.id}`);
await until(() => document.querySelector('.vis video, .vis img'));
for (let i = entry.media.findIndex((m) => m.still?.outcome === 'still'); i > 0; i--) {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight' }));
await sleep(300);
}
await until(() => document.querySelector('.vis .azione-salva-fotogramma') && document.querySelector('.vis video')?.readyState >= 2);
const video = document.querySelector('.vis video');
video.pause();