E3: formati e fotogrammi nella copia verso le cartelle esterne

La richiesta di copia porta i formati («Copia in…» per foto e video, poi
la destinazione, poi le impostazioni), i fotogrammi dei video e la «Copia
di nuovo» di una sola copia. Il piano prevede convertiti, copiati com'è e
fotogrammi; il lavoro si ricorda di fotogrammi ed identità esatta per la
ripresa.

La copia converte prima dei controlli di spazio e di FAT32, adotta un file
già presente solo se lunghezza e SHA-256 della conversione coincidono, e
prende i fotogrammi di un video in un solo passaggio, ognuno con il suo
istante esatto come identità. Un file copiato in qualunque forma che non
sia un fotogramma è «già copiato»; un fotogramma non rende mai copiato il
file (nuovo segno FrameOnly). Le note sono un elenco di codici, con i testi
italiani nuovi e il rapporto che mostra i file copiati con una nota.

Le prove dell'archivio e dei piani delle query seguono le nuove ricerche;
due prove nuove coprono una foto convertita e un fotogramma.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-27 23:08:38 +01:00
1 parent 704c1ed9cf
commit b746aff45d
19 files changed
+1941 -257

No files matched your search

+18 -7
View File
@@ -534,26 +534,37 @@ public sealed class ExportStoreTests
using var temp = new TempFolder();
await using var db = await TestDatabase.OpenAsync(temp);
var w = await CreateAsync(db);
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1), ExportVariant.Whole, ExportFormat.Original));
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1)));
var own = await db.Exports.AddCopyAsync(w.WholeCopy("a.jpg", destination: w.Own));
var general = await db.Exports.AddCopyAsync(w.WholeCopy("luca.demo/a.jpg", account: w.Luca, media: w.LucaMedia));
await db.Exports.AddCopyAsync(w.WholeCopy("marta.demo/a.jpg") with { State = ExportCopyState.Removed });
Assert.AreEqual(general.Id, (await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1), ExportVariant.Whole, ExportFormat.Original))!.Id, "the newest Copied row");
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1), ExportVariant.Whole, ExportFormat.Jpg), "another format");
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(2), ExportVariant.Whole, ExportFormat.Original));
Assert.AreEqual(general.Id, (await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1)))!.Id, "the newest Copied row");
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(2)));
// Tappa E3 (D3): a file copied in any form but a frame counts; a frame never does.
var converted = await db.Exports.AddCopyAsync(w.WholeCopy("luca.demo/c.jpg", account: w.Luca, media: w.LucaMedia) with
{
SourceSha256 = Make.Sha(3), CopySha256 = Make.Sha(4), Variant = ExportVariant.Converted, Format = ExportFormat.Jpg,
});
Assert.AreEqual(converted.Id, (await db.Exports.FindCopiedElsewhereAsync(Make.Sha(3)))!.Id, "a Converted Jpg copy counts");
await db.Exports.AddCopyAsync(w.WholeCopy("luca.demo/f_t0m01s000.png", account: w.Luca, media: w.LucaMedia) with
{
SourceSha256 = Make.Sha(7), CopySha256 = Make.Sha(8), Variant = ExportVariant.Frame, Format = ExportFormat.Png, FrameAt = TimeSpan.FromSeconds(1),
});
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(7)), "a frame does not count");
await db.Exports.RetireDestinationAsync(w.General, Make.T0.AddDays(1));
Assert.AreEqual(own.Id, (await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1), ExportVariant.Whole, ExportFormat.Original))!.Id);
Assert.AreEqual(own.Id, (await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1)))!.Id);
await db.Exports.RetireDestinationAsync(w.Own, Make.T0.AddDays(1));
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1), ExportVariant.Whole, ExportFormat.Original), "a retired folder is not in use");
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1)), "a retired folder is not in use");
// A copy whose account was removed has no account to be «per un altro account».
var third = await db.Exports.AddDestinationAsync(Destination(ExportScope.General, null, @"G:\Nuova"));
var orphan = await db.Exports.AddCopyAsync(w.WholeCopy("marta.demo/a.jpg", destination: third.Id));
await db.Accounts.DeleteAsync(w.Marta);
Assert.IsNull((await db.Exports.GetCopyAsync(orphan.Id))!.AccountId);
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1), ExportVariant.Whole, ExportFormat.Original));
Assert.IsNull(await db.Exports.FindCopiedElsewhereAsync(Make.Sha(1)));
}
[TestMethod]