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:
1 parent
704c1ed9cf
commit
b746aff45d
19 files changed
+1941
-257
No files matched your search
@@ -603,6 +603,7 @@ public sealed class ExportConstraintTests
|
||||
("ListItemsAsync", ExportStore.ItemsOfRunSql(false), [("@r", run), ("@after", 0L), ("@limit", 500L)], false),
|
||||
("ListItemsAsync (stato)", ExportStore.ItemsOfRunSql(true), [("@r", run), ("@s", "Pending"), ("@after", 0L), ("@limit", 500L)], false),
|
||||
("ListPendingAsync", MediaConversionStore.PendingSql, [("@after", 0L), ("@limit", 500L)], false),
|
||||
("FirstItemIdAsync", ExportStore.FirstItemSql, [("@r", run), ("@m", 1L), ("@v", "Frame"), ("@f", "Png")], false),
|
||||
};
|
||||
var problems = new List<string>();
|
||||
foreach (var (name, sql, parameters, sortAllowed) in lookups)
|
||||
@@ -637,7 +638,12 @@ public sealed class ExportConstraintTests
|
||||
var lookupsE2 = new (string Name, string Sql, (string, object?)[] Parameters, bool SortAllowed)[]
|
||||
{
|
||||
("FindReplacedCopyAsync", ExportStore.ReplacedCopySql, [("@h", Make.Sha(5008)), ("@d", w.General), ("@a", w.Marta)], false),
|
||||
("FindCopiedElsewhereAsync", ExportStore.CopiedElsewhereSql, [("@h", Make.Sha(17)), ("@v", "Whole"), ("@f", "Original"), ("@a", w.Marta)], true),
|
||||
("FindCopiedElsewhereAsync", ExportStore.CopiedElsewhereSql, [("@h", Make.Sha(17)), ("@a", w.Marta)], true),
|
||||
|
||||
// Tappa E3 (D3): the lookups of a file in any form but a frame sort the few rows of one SHA-256.
|
||||
("ListCurrentCopiesAnyFormAsync", ExportStore.CurrentCopiesAnyFormSql, [("@h", Make.Sha(17)), ("@d", w.General), ("@a", w.Marta)], true),
|
||||
("FindLatestCopyAnyFormAsync", ExportStore.LatestCopyAnyFormSql, [("@h", Make.Sha(17)), ("@d", w.General), ("@a", w.Marta)], true),
|
||||
("ClearFailedAsync", ExportStore.ClearFailedSql, [("@h", Make.Sha(17)), ("@d", w.General), ("@a", w.Marta), ("@v", "Converted"), ("@f", "Png")], false),
|
||||
("GetCopyStatesAsync", ExportStore.CopyStatesSql(shas), Shas(("@d", w.General)), false),
|
||||
("GetCopyStatesAsync (sostituiti)", ExportStore.ReplacedStatesSql(shas), Shas(("@d", w.General)), false),
|
||||
};
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user