feat(app): a card without saved settings imports with its camera's profile

BRIEF §13 camera profiles: the settings saved last by another card of the same
camera model; a card seen for the first time takes them once its first plan
names the camera. Remembered cards without settings start from the archive's
templates.

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-02 22:35:00 +00:00
1 parent 55469ae086
commit 758bcb162f
3 files changed
+65 -3

No files matched your search

+17
View File
@@ -1,4 +1,5 @@
using Titano.Core.Import;
using Titano.Core.Model;
using Titano.Core.Naming;
using Titano.Data.Archiving;
@@ -92,3 +93,19 @@ public sealed record ImportChoices
private static bool UsesTitle(string template) => template.Contains("{title", StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// Camera profiles (BRIEF §13): a card without saved settings imports with the settings saved last by another card
/// of the same camera model, so a new card for a known camera needs no setup.
/// </summary>
public static class CameraProfiles
{
public static CardProfile? Find(string? make, string? model, IEnumerable<MediaCard> cards) =>
model is null
? null
: cards.Where(c => c.ProfileJson is { Length: > 0 } && string.Equals(c.CameraModel, model, StringComparison.Ordinal)
&& string.Equals(c.CameraMake, make, StringComparison.Ordinal))
.MaxBy(c => c.LastSeen) is { } source
? ImportService.ProfileOf(source)
: null;
}