fix(app): import gates, partial results and plan editing after review

- a card that leaves needs a new check; formatting re-lists the card and refuses
  one that changed since its check; files that are not photos are named in the
  format confirmation
- an import never stays stuck in Running; Retry never resumes an older job
- server imports list refused files and keep what was uploaded when stopped
- the archive result matches each copy to its job's record and shows the job's
  own error per file
- refreshing devices keeps typed titles and choices; titles lock while copying
- three destination names, merge and split of sessions, camera profiles shared
  by the cards of a camera, photo counts and a new-card toast
- disabled controls say why; keyboard focus follows the nickname field and
  Show plan (Esc closes it); label column fits longer languages
- capture states for insertion, running, failed and a new card

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-03 10:44:22 +00:00
1 parent 5aa5edab57
commit 29c82eba5c
27 files changed
+1286 -285

No files matched your search

+23 -12
View File
@@ -13,7 +13,8 @@ namespace Titano.App.Import;
/// <summary>
/// Capture and smoke-test data ONLY (<c>--capture</c>, never the user's data): a simulated Canon EOS R5 card in the
/// capture folder — a night, a dawn and a sunset session of small JPEGs with Exif — remembered as "EOS R5 · card A",
/// a second remembered card that is not inserted, a USB drive without DCIM, and the import result shown afterwards.
/// a Sony card seen for the first time, a second remembered card that is not inserted, a USB drive without DCIM, and
/// the import result shown afterwards.
/// </summary>
public static class SampleCards
{
@@ -28,16 +29,26 @@ public static class SampleCards
(new DateTime(2026, 9, 28, 18, 2, 11), 24, 2),
];
/// <summary>The new card's one session: a morning harbour series.</summary>
private static readonly (DateTime Start, int Photos, int Interval)[] NewSessions = [(new DateTime(2026, 9, 30, 7, 15, 0), 12, 5)];
/// <summary>The inserted card: its root is a folder of the capture environment.</summary>
public static CardDevice Card(string dataDirectory) =>
new(Path.Combine(dataDirectory, "card") + Path.DirectorySeparatorChar, "EOS_DIGITAL", Serial, 127_865_454_592, 31_665_454_592, IsRemovable: true,
HasDcim: true);
/// <summary>Writes the card's photos, remembers both cards (the inserted one with its last import) and inserts the card and a USB drive.</summary>
/// <summary>A Sony card Titano has never seen (the nickname field and the "new card" toast).</summary>
public static CardDevice NewCard(string dataDirectory) =>
new(Path.Combine(dataDirectory, "newcard") + Path.DirectorySeparatorChar, "SONY", 0x2B7E1A09, 63_864_569_856, 60_120_000_000, IsRemovable: true,
HasDcim: true);
/// <summary>Writes the cards' photos, remembers two cards (the inserted one with its last import) and inserts both cards and a USB drive.</summary>
public static async Task InsertAsync(TitanoDatabase db, SampleDeviceMonitor devices, string dataDirectory)
{
var card = Card(dataDirectory);
WritePhotos(card.Root);
WritePhotos(Path.Combine(card.Root, "DCIM", "100CANON"), "IMG_", Sessions, "Canon", "Canon EOS R5", "0431");
var newCard = NewCard(dataDirectory);
WritePhotos(Path.Combine(newCard.Root, "DCIM", "100MSDCF"), "DSC0", NewSessions, "SONY", "ILCE-7M4", "4410287");
var known = new MediaCard
{
Id = Guid.CreateVersion7(),
@@ -69,6 +80,7 @@ public static class SampleCards
LastSeen = LastImport.AddDays(-6),
});
devices.Insert(card);
devices.Insert(newCard);
devices.Insert(new CardDevice(@"F:\", "USB DRIVE", 0x51E02B44, 2_000_398_934_016, 1_800_000_000_000, IsRemovable: true, HasDcim: false));
}
@@ -88,26 +100,25 @@ public static class SampleCards
]);
}
private static void WritePhotos(string root)
private static void WritePhotos(string folder, string prefix, (DateTime Start, int Photos, int Interval)[] sessions, string make, string model, string body)
{
var folder = Path.Combine(root, "DCIM", "100CANON");
if (Directory.Exists(folder)) return;
Directory.CreateDirectory(folder);
var n = 1;
foreach (var (start, photos, interval) in Sessions)
foreach (var (start, photos, interval) in sessions)
{
for (var i = 0; i < photos; i++, n++)
{
var captured = start.AddSeconds(i * interval);
var path = Path.Combine(folder, $"IMG_{n:0000}.JPG");
File.WriteAllBytes(path, Photo(captured, n));
var path = Path.Combine(folder, $"{prefix}{n:0000}.JPG");
File.WriteAllBytes(path, Photo(captured, n, make, model, body));
File.SetLastWriteTime(path, captured);
}
}
}
/// <summary>A small sky gradient with grain (distinct bytes per photo) and the camera's Exif.</summary>
private static byte[] Photo(DateTime captured, int seed)
private static byte[] Photo(DateTime captured, int seed, string make, string model, string body)
{
const int Width = 96, Height = 64;
using var image = new ImageBuffer(Width, Height, 3, clear: false);
@@ -126,9 +137,9 @@ public static class SampleCards
}
var exif = ExifWriter.BuildJpegApp1(new FrameMetadata
{
Make = "Canon",
Model = "Canon EOS R5",
BodySerial = "0431",
Make = make,
Model = model,
BodySerial = body,
CapturedAt = captured,
Iso = 100,
ExposureTime = 1.0 / 250,