feat(import): import a whole folder as one sequence per format
Owner review 2, R9: Import › Folder… gains a "Group" choice for picked folders: Sessions (as before) or Whole folder. A whole folder, with its subfolders when Subfolders is on, becomes one sequence per file format; camera bodies and pauses are ignored, while RAW+JPEG of the same shots stays two sequences so no frame is ever doubled. Only the user's splits break it, and Merge joins a split part back. The planner implements it (ImportOptions.Grouping, Core, Linux-tested): the session key is "folder-" plus a hash of this PC's name, the full path and the format, so an interrupted or repeated import continues the same sequence; the default title is the folder's name. The plan shows one row per format with the format and the number of cameras. Cards and drives always import by sessions; the choice is not part of a card profile and a folder starts on Sessions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5209579631
commit
445dfd41a3
14 files changed
+419
-26
No files matched your search
@@ -105,6 +105,35 @@ public sealed class ImportServiceTests(TestContext context)
|
||||
Assert.Equal(20, (await FramesAsync(fx, plan.Sessions.Single())).Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AWholeFolderBecomesOneSequenceNamedAfterItThatALaterImportAddsTo()
|
||||
{
|
||||
await using var fx = await CreateAsync(context);
|
||||
var folder = Path.Combine(context.CreateTempDirectory("source"), "Etna eruption");
|
||||
Photos.WriteSeries(folder, Start, 5);
|
||||
Photos.WriteSeries(folder, Start.AddHours(4), 5, firstSeed: 20, prefix: "NIK_", make: "NIKON CORPORATION", model: "NIKON Z 8");
|
||||
var whole = new ImportOptions { Grouping = ImportGrouping.WholeFolder };
|
||||
|
||||
var plan = await fx.Service.PlanImportAsync(fx.Archive.Id, folder, whole, null, null, fx.Ct);
|
||||
var session = plan.Sessions.Single();
|
||||
await RunAsync(fx, plan);
|
||||
var id = await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Id, session.SessionKey);
|
||||
Assert.Equal("Etna eruption", (await fx.Db.Sequences.GetAsync(id!.Value))!.Title);
|
||||
Assert.Equal(10, (await FramesAsync(fx, session)).Count);
|
||||
|
||||
// Photos added to the folder later join the same sequence; those imported before are found in the archive.
|
||||
Photos.WriteSeries(folder, Start.AddDays(1), 3, firstSeed: 40, prefix: "LATE_");
|
||||
var later = await fx.Service.PlanImportAsync(fx.Archive.Id, folder, whole, null, null, fx.Ct);
|
||||
Assert.Equal(session.SessionKey, later.Sessions.Single().SessionKey);
|
||||
Assert.Equal(session.Folder, later.Sessions.Single().Folder);
|
||||
Assert.Equal(3, later.CopyCount);
|
||||
await RunAsync(fx, later);
|
||||
Assert.Equal(13, (await FramesAsync(fx, session)).Count);
|
||||
|
||||
static Task<ImportProgress> RunAsync(ArchiveFixture fx, ImportPlan plan) => fx.Service.Imports.ExecuteAsync(
|
||||
new ImportJobParameters(fx.Archive.Id, plan, null, true, null), Guid.NewGuid(), 0, _ => ValueTask.CompletedTask, null, fx.Ct);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ErasingTheCardDeletesOnlyVerifiedImports()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user