E4: prove dei video fermi e dimostrazione a ogni ora

Completa l'elenco di prove del progetto: analizzatore (grana, luce che
pulsa, foto notturna, contenitori, durata sconosciuta, flussi rovinati),
servizio (lavori lunghi, file spariti o cambiati, errori, «Interrompi»,
chiusura), copie del fotogramma (pausa e ripresa, validazione, video
sempre intero), API (selezioni, stesso file, eventi) e l'interfaccia
vera nel browser: visualizzatore, «Salva il fotogramma», «Cerca i video
fermi», Dashboard e filtro «Video fermi».

Le prove hanno trovato che la dimostrazione dipendeva dall'ora: la
storia ferma poteva avere la copertina del video fermo di marta (un file
solo invece di due) e il video «Non analizzabile» poteva mancare. Ora la
storia è su un'altra immagine e, se le immagini senza copie non bastano,
si usano quelle di foto copiate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 15:51:03 +01:00
1 parent eea4394a0f
commit 066addbc84
10 files changed
+1100 -18

No files matched your search

+28 -10
View File
@@ -11,8 +11,8 @@ namespace Febe.Web.Demo;
/// <summary>
/// The still videos of the demo (spec §4.10 «Video fermi», tappa E4): two videos (the newest of @marta.demo and the
/// newest story video of another account) become their cover picture alone for two seconds, each in its own file
/// recorded with its own SHA-256 (so «Salva il fotogramma» works both with «Scarica» and «Nella cartella delle copie»),
/// newest story video of another account, on another picture) become their cover picture alone for two seconds, each in
/// its own file recorded with its own SHA-256 (so «Salva il fotogramma» works both with «Scarica» and «Nella cartella delle copie»),
/// with a «Fermo» analysis that the real analyser gave on that file. Another video of @marta.demo has an «In movimento»
/// analysis (of the demo's moving file), a third «Non analizzabile» because it took too long («Analizza di nuovo»); the
/// rest is never analysed, so «È un video fermo?» and «Cerca i video fermi» work live. Analyses are only on request in
@@ -41,8 +41,9 @@ public static class DemoStillVideos
var now = clock.Now;
var folder = Path.GetDirectoryName(movingFile)!;
var own = await VideosAsync(database, world, new LibraryFilter { AccountIds = [marta.Id] }, 3, null, ct).ConfigureAwait(false);
var story = await VideosAsync(database, world, new LibraryFilter { Kind = LibraryKindFilter.Stories }, 1, marta.Id, ct).ConfigureAwait(false);
var own = await VideosAsync(database, world, new LibraryFilter { AccountIds = [marta.Id] }, 3, null, [], ct).ConfigureAwait(false);
var story = await VideosAsync(
database, world, new LibraryFilter { Kind = LibraryKindFilter.Stories }, 1, marta.Id, [.. own.Select(m => m.Sha256!)], ct).ConfigureAwait(false);
var stills = own.Take(1).Concat(story).ToList();
var thumbnails = new ThumbnailStore(data.Thumbnails);
var n = 0;
@@ -126,13 +127,17 @@ public static class DemoStillVideos
}
/// <summary>
/// Up to <paramref name="count"/> present videos of the filter, newest first, each on its own cover picture, that no
/// copy uses (the copies of the demo keep the SHA-256 they were made from) and not of <paramref name="exceptAccount"/>.
/// Up to <paramref name="count"/> present videos of the filter, newest first, each on its own cover picture, not of
/// <paramref name="exceptAccount"/> and not on a picture of <paramref name="exceptShas"/> (the accounts share pictures,
/// and one picture gives one still file). First the pictures that no copy uses (the copies of the demo keep the SHA-256
/// they were made from); how many there are depends on the day and the hour the demo is built, so when they are not
/// enough the pictures of copied photos follow, never the video of a copy.
/// </summary>
private static async Task<List<Media>> VideosAsync(FebeDatabase database, DemoWorld world, LibraryFilter filter, int count, long? exceptAccount, CancellationToken ct)
private static async Task<List<Media>> VideosAsync(FebeDatabase database, DemoWorld world, LibraryFilter filter, int count, long? exceptAccount, IReadOnlyList<string> exceptShas, CancellationToken ct)
{
var found = new List<Media>();
var shas = new HashSet<string>(StringComparer.Ordinal);
var spare = new List<Media>();
var shas = new HashSet<string>(exceptShas, StringComparer.Ordinal);
LibraryCursor? cursor = null;
do
{
@@ -141,12 +146,24 @@ public static class DemoStillVideos
{
if (tile.CoverKind != MediaKind.Video || tile.CoverMediaId is not { } id || tile.AccountId == exceptAccount
|| await database.Media.GetAsync(id, ct).ConfigureAwait(false) is not { Sha256: { } sha, RelativePath: not null } media
|| !EntryStateRules.IsPresent(media.State) || !world.Pictures.ContainsKey(sha) || !shas.Add(sha)
|| (await database.Exports.ListCopiesBySha256Async(sha, ct).ConfigureAwait(false)).Count > 0)
|| !EntryStateRules.IsPresent(media.State) || !world.Pictures.ContainsKey(sha) || shas.Contains(sha))
{
continue;
}
var copies = await database.Exports.ListCopiesBySha256Async(sha, ct).ConfigureAwait(false);
if (copies.Any(c => c.MediaId == media.Id || c.Variant == ExportVariant.Frame))
{
continue;
}
shas.Add(sha);
if (copies.Count > 0)
{
spare.Add(media);
continue;
}
found.Add(media);
if (found.Count == count)
{
@@ -158,6 +175,7 @@ public static class DemoStillVideos
}
while (cursor is not null);
found.AddRange(spare.Take(count - found.Count));
return found;
}
}
+1 -1
View File
@@ -279,7 +279,7 @@ scrive mai nella libreria vera e non usa la rete.
converte». La conversione della libreria non parte mai. «Nella cartella delle copie» dei fotogrammi di un video
finisce in errore («non corrisponde»): i video condividono l'impronta della loro copertina, non quella del file.
- Video fermi (tappa E4, `Demo/DemoStillVideos.cs`): il video più recente di @marta.demo e la storia video più recente
di un altro account sono la loro copertina ferma per 2 secondi dopo una breve dissolvenza dal nero
di un altro account (su un'altra immagine) sono la loro copertina ferma per 2 secondi dopo una breve dissolvenza dal nero
(`campioni/video-fermo-dimostrativo-1.mp4` e `-2.mp4`, da `H264PcmWriter.DemoStillVideo`), ciascuno registrato con
l'impronta del suo file: «Salva il fotogramma» funziona anche «Nella cartella delle copie». Hanno un'analisi «Fermo»
data dall'analizzatore vero (il filtro «Video fermi» li mostra); il video dopo di @marta.demo è «In movimento», quello