E4: filtro «Video fermi» della libreria (kind=stillvideos)
Risposta 40 di Alberto: fra i filtri «Tipo», dopo «Video», solo nella Libreria. Mostra gli elementi di ogni tipo con un video in libreria la cui ultima analisi (l'algoritmo più alto) dice «Fermo»; in «Tutte le foto» solo quei video. Un video mai analizzato non c'è: l'analisi è solo a richiesta. L'elenco degli elementi si legge una volta per istruzione dagli esiti fermi (ix_video_analysis_still) ai file (ix_media_sha256_entry), su indici coprenti; CROSS JOIN e il + unario tengono SQLite su quei piani: senza, i conteggi per elemento giravano tutti gli SHA-256 fermi a ogni elemento (107 s per un account con 10.000 video fermi). LibraryScaleTests riempie 21.000 analisi (11.000 «Fermo») e misura finestre (55-105 ms, limite 250), totali e giorni. Prove del filtro sul database e via API. L'interfaccia (la voce in library.js) è di WP6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
51150fb611
commit
78502e9c14
7 files changed
+361
-9
No files matched your search
@@ -293,6 +293,32 @@ public sealed class StillVideosApiTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(120_000, CooperativeCancellation = true)]
|
||||
public async Task TheLibraryFilterVideoFermiShowsWhatTheAnalysisFound()
|
||||
{
|
||||
// Answer 40: «Video fermi» among the kinds of the library, kind=stillvideos; only what was analysed and is still.
|
||||
await using var server = await StartAsync();
|
||||
var marta = await AccountAsync(server);
|
||||
var post = await WebLibrary.AddPostAsync(server, marta, "fermo", Make.T0.AddDays(-1), WebLibrary.Photo(4), WebLibrary.Video(Still(3)), WebLibrary.Video(Moving()));
|
||||
var other = await WebLibrary.AddPostAsync(server, marta, "mosso", Make.T0.AddDays(-2), WebLibrary.Video(PcmVideos.Mp4(12, i => PcmVideos.Photo(200 + i))));
|
||||
Assert.AreEqual(0, (await server.GetJsonAsync("/api/library/days?kind=stillvideos")).Int("entries"), "nothing analysed yet: analysis is on request");
|
||||
|
||||
foreach (var media in new[] { post.Media[1], post.Media[2], other.Media[0] })
|
||||
{
|
||||
Assert.AreEqual(HttpStatusCode.OK, (await server.SendJsonAsync(HttpMethod.Post, $"/api/media/{media.Id}/still")).Status);
|
||||
}
|
||||
|
||||
var grouped = await server.GetJsonAsync("/api/library?kind=stillvideos&limit=50");
|
||||
CollectionAssert.AreEqual(new[] { post.Entry.Id }, grouped.Items("tiles").Select(t => t.Long("id")).ToArray());
|
||||
Assert.AreEqual(1, (await server.GetJsonAsync("/api/library/days?kind=stillvideos")).Int("entries"));
|
||||
var files = await server.GetJsonAsync("/api/library?mode=files&kind=StillVideos&limit=50");
|
||||
CollectionAssert.AreEqual(new[] { post.Media[1].Id }, files.Items("tiles").Select(t => t.GetProperty("cover").Long("mediaId")).ToArray(), "only the still video, not the photo nor the moving video of the post");
|
||||
Assert.AreEqual(1, (await server.GetJsonAsync("/api/library/days?mode=files&kind=stillvideos")).Int("files"));
|
||||
Assert.AreEqual(1, (await server.GetJsonAsync($"/api/library/days?kind=stillvideos&accounts={marta.Id}")).Int("entries"));
|
||||
Assert.AreEqual(HttpStatusCode.BadRequest, (await server.SendJsonAsync(HttpMethod.Get, "/api/library?kind=fermi")).Status);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task CommandsOfStillVideosComeOnlyFromFebesPages()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user