E3: correzioni della revisione di formati e fotogrammi
Le 16 osservazioni confermate della revisione, ognuna con la sua prova: - JPEG: il controllo stima la memoria di lavoro del decodificatore (progressivo), così un file che non si decodifica esce «troppo grande» e non «illeggibile». - Un EXIF che non si tiene lascia un EXIF minimo con l'orientamento, perché la foto convertita non esca girata. - Fotogrammi: istanti in millisecondi interi; la copia trova l'indice del nome dall'istante, non dall'ordine delle righe. - Video di durata sconosciuta misurati prima di registrare: contano nei limiti di 500 per richiesta e 5000 per video. - Rimuxaggio: la durata del segmento di elst passa nell'MP4, la fine tagliata resta nascosta (anche nei fotogrammi). - H.264: il punto di recupero vale come IDR solo con exact_match_flag. - MP3 in MP4: objectTypeIndication 0x69 fino a 24 kHz, 0x6B oltre. - Conversione della libreria: il lavoro toglie le righe di un formato spento o cambiato; spegnere toglie anche i «Non riuscito»; «Riprova» solo i formati di adesso; pausa per spazio prima di rileggere l'originale. - «Anche i N» conta e mette in coda solo il tipo che si cambia; le impostazioni dell'esportazione si salvano una per volta. - Eliminazione e «Tieni il più grande» scelgono i convertiti nella stessa transazione: nessun convertito orfano. - Un file arrivato tardi in un elemento vecchio mette in coda solo sé (file nuovo = salvato da quando il formato è scelto). - Zip dei fotogrammi a pezzi di 64 KB: un browser lento che legge non si interrompe, uno fermo sì. Decisioni in docs/decisioni.md (28/11), §4.10 della specifica precisato. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb79b05fda
commit
958cb71cd6
38 files changed
+1276
-222
No files matched your search
@@ -364,6 +364,58 @@ public sealed class ExportFormatsApiTests
|
||||
Assert.IsFalse(File.Exists(Path.ChangeExtension(WebLibrary.PathOf(server, marta, later.Media[0]), ".jpg")));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(120_000, CooperativeCancellation = true)]
|
||||
public async Task TheQuestionOfOneKindNeitherCountsNorQueuesTheOther()
|
||||
{
|
||||
var ct = TestContext.CancellationToken;
|
||||
await using var server = await StartAsync();
|
||||
var marta = await server.Db.Accounts.AddAsync(Make.Account("marta.demo"));
|
||||
var png = await WebLibrary.AddPostAsync(server, marta, "png", Make.T0.AddDays(-1), WebLibrary.Image(PngBytes(8), ".png"));
|
||||
var video = WebLibrary.DemoVideo(3);
|
||||
var mov = await WebLibrary.AddPostAsync(server, marta, "mov", Make.T0.AddDays(-2), video with { Extension = ".mov" });
|
||||
|
||||
// Photos to JPG, «Solo i nuovi»: the PNG already in the library is left alone.
|
||||
var (status, saved) = await server.SendJsonAsync(HttpMethod.Put, "/api/export/settings", new { libraryPhotoFormat = "jpg", convertExisting = false });
|
||||
Assert.AreEqual(HttpStatusCode.OK, status, saved.ToString());
|
||||
Assert.AreEqual(0, saved.Int("queued"));
|
||||
|
||||
// Then videos to MP4: the question counts the MOV only, and «Anche i N» queues it only.
|
||||
var preview = await server.GetJsonAsync("/api/export/library-conversion/preview?video=mp4");
|
||||
Assert.AreEqual((1, (long)video.Bytes.Length), (preview.Int("files"), preview.Long("bytes")), preview.ToString());
|
||||
(status, saved) = await server.SendJsonAsync(HttpMethod.Put, "/api/export/settings", new { libraryVideoFormat = "mp4", convertExisting = true });
|
||||
Assert.AreEqual(HttpStatusCode.OK, status, saved.ToString());
|
||||
Assert.AreEqual(1, saved.Int("queued"));
|
||||
Assert.IsEmpty(await server.Db.Conversions.ListByMediaAsync(png.Media[0].Id, ct), "the photo refused with «Solo i nuovi» stays so");
|
||||
Assert.AreEqual(ExportFormat.Mp4, (await server.Db.Conversions.ListByMediaAsync(mov.Media[0].Id, ct)).Single().Format);
|
||||
|
||||
// Asked about both (no kind named), the preview counts what both formats would add.
|
||||
Assert.AreEqual(1, (await server.GetJsonAsync("/api/export/library-conversion/preview")).Int("files"), "the PNG");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(120_000, CooperativeCancellation = true)]
|
||||
public async Task TwoQuickChangesOfTheSettingsAreBothKept()
|
||||
{
|
||||
await using var server = await StartAsync();
|
||||
for (var round = 0; round < 10; round++)
|
||||
{
|
||||
var (status, saved) = await server.SendJsonAsync(HttpMethod.Put, "/api/export/settings", new { photoFormat = "jpg", videoFormat = "mp4" });
|
||||
Assert.AreEqual(HttpStatusCode.OK, status, saved.ToString());
|
||||
|
||||
// Two clicks one after the other: two requests at once, each changing one format.
|
||||
var photo = server.SendJsonAsync(HttpMethod.Put, "/api/export/settings", new { photoFormat = "original" });
|
||||
var video = server.SendJsonAsync(HttpMethod.Put, "/api/export/settings", new { videoFormat = "original" });
|
||||
foreach (var (code, body) in await Task.WhenAll(photo, video))
|
||||
{
|
||||
Assert.AreEqual(HttpStatusCode.OK, code, body.ToString());
|
||||
}
|
||||
|
||||
var overview = await server.GetJsonAsync("/api/export");
|
||||
Assert.AreEqual(("original", "original"), (overview.Str("photoFormat"), overview.Str("videoFormat")), $"round {round}");
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------- support
|
||||
|
||||
/// <summary>A HEIC as far as its name and brand go: Febe copies it as it is, it never decodes it.</summary>
|
||||
|
||||
Reference in new issue
Block a user