fix: conversions name, lock and settle as phase 4a's writers do
Phase 4b was built on phase 4a before its review fixes. Integrated on the reviewed 4a, the
conversion now follows the same rules as filing and the other writers.
- Names: a converted file is named as filing names a photo of its sequence (FrameNaming: the
archive's file template, the frame's context in the sequence with its camera, lens, number
and title, {name} the card's, {ext} the target's, a long name keeping its extension).
Replace through ConvertOptions.FileName; New sequence through the ingest itself
(StagedFrame.NamedAs), which numbers and names the copies in the new sequence. Names stay
unique against every file present, those leaving included, so a Replace never moves onto a
file; a test pins a stray file that keeps its bytes.
- Leases: stage A starts from the sidecar settled under the sequence's lease where the index
has it then (SequenceWriter.ReadLocked), and FrameTrash.ReplaceAsync reads the row again
under the lease, so a folder a Reorganize moved meanwhile is followed, never made again.
A Reorganize the archive waits for keeps the conversion off its sequences (pinned).
- Journals: the replace journal is settled with the others. MassRenamer steps, restores into
a sequence and sequence deletions wait for an unsettled replacement as they wait for a
restore, and so do photo deletions, whose frames version the recovery reads
(FrameTrash.EnsureReplaced); a scan settles it and reconciles nothing meanwhile; a restore
settles its sequence's replace journal first, at the folder the index has under the lease.
- The convert job tells each sequence converted or made as it completes, as a Reorganize
tells each step, so an editor open on it reads it again while the rest of the job runs.
- Desktop: JobKind.Convert gets its row in the settings' job priority list. A click on Apply
that commits the quality no longer starts the same dry run again under the click (as 4a
fixed for Reorganize).
- Panel: a dry run answered during the confirmation with the same plan no longer drops the
confirmed Apply; a different plan is shown with Admin.Convert.PlanChanged (en, it).
- Tests: TrashDialogTests.EmptyQueuesTheJobOfTheConfirmedPlanOnly waits for the command to
end before running it again (a running AsyncRelayCommand ignored the second Execute).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2e0d1d6dcc10575734970bb9c77749f00777c859)
This commit is contained in:
1 parent
a1c1c21ebd
commit
341fb77507
22 files changed
+345
-91
No files matched your search
@@ -7,6 +7,7 @@ using Chronos.Core.Imaging;
|
||||
using Chronos.Core.Imaging.Decoders;
|
||||
using Chronos.Core.Metadata;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Naming;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Core.Tests.Conversion;
|
||||
@@ -253,12 +254,35 @@ public sealed class FrameConverterTests(TestContext context)
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConvertedNamesKeepTheStemAndTheCaseOfTheExtension()
|
||||
public void ConvertedNamesAreTheNamesFilingGives()
|
||||
{
|
||||
Assert.Equal("originals/IMG_0001.DNG", new ConvertOptions(ConvertTarget.LinearDng).NameFor("originals/IMG_0001.CR2"));
|
||||
Assert.Equal("originals/img_0001.tif", new ConvertOptions(ConvertTarget.Tiff16).NameFor("originals/img_0001.cr3"));
|
||||
Assert.Equal("originals/2026-09-28_0001.jpg", new ConvertOptions(ConvertTarget.Jpeg).NameFor("originals/2026-09-28_0001.Nef"));
|
||||
Assert.Equal("frame.jpg", new ConvertOptions(ConvertTarget.Jpeg).NameFor("frame"));
|
||||
var dng = new ConvertOptions(ConvertTarget.LinearDng);
|
||||
Assert.Equal("originals/IMG_0001.dng", dng.WithExtension("originals/IMG_0001.CR2"));
|
||||
Assert.Equal("frame.jpg", new ConvertOptions(ConvertTarget.Jpeg).WithExtension("frame"));
|
||||
|
||||
// The second frame of a sequence filed by a Canon, named with the sequence's camera, its number, the title and the
|
||||
// name it had on the card, as an upload or a Reorganize names it; {ext} is the target's.
|
||||
var first = Frame("2026-09-28_0001.CR3", ImageFileFormat.Cr3, 96, 64) with { I = 0, Original = "IMG_0001.CR3" };
|
||||
var second = Frame("2026-09-28_0002.CR3", ImageFileFormat.Cr3, 96, 64) with { I = 1, Original = "IMG_0002.CR3", CapturedAt = Captured.AddSeconds(10) };
|
||||
var sequence = new SequenceManifest
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Title = "Harbour",
|
||||
Camera = new SidecarCamera { Make = "Canon", Model = "Canon EOS R5" },
|
||||
Frames = [first, second],
|
||||
};
|
||||
Assert.Equal("originals/Harbour_Canon EOS R5_0002_IMG_0002.dng",
|
||||
dng.FileName(PathTemplate.Parse("{title}_{camera}_{n}_{name}.{ext}"), second, sequence));
|
||||
Assert.Equal("originals/2026-09-28_0002.tif",
|
||||
new ConvertOptions(ConvertTarget.Tiff16).FileName(PathTemplate.Parse("{date}_{n}"), second, sequence));
|
||||
Assert.Equal(PathTemplate.Parse("{date}_{n}").ExpandFile(FrameNaming.Context(second with { File = "originals/x.dng" }, sequence, "Harbour")),
|
||||
Path.GetFileName(dng.FileName(PathTemplate.Parse("{date}_{n}"), second, sequence)));
|
||||
// A frame adopted in place stays in its folder; a long name keeps the target's extension whole.
|
||||
var adopted = second with { File = "IMG_0002.CR3", Original = new string('x', 300) + ".CR3" };
|
||||
var named = dng.FileName(PathTemplate.Parse("{name}.{ext}"), adopted, sequence);
|
||||
Assert.False(named.Contains('/'));
|
||||
Assert.True(named.EndsWith(".dng", StringComparison.Ordinal) && named.Length <= PathTemplate.MaxSegmentLength, named);
|
||||
|
||||
Assert.Equal(ConvertTarget.LinearDng, ConvertOptions.ArchivalTarget);
|
||||
Assert.False(new ConvertOptions(ConvertTarget.Jpeg, 0).IsValid);
|
||||
Assert.False(new ConvertOptions(ConvertTarget.Jpeg, 101).IsValid);
|
||||
|
||||
Reference in new issue
Block a user