feat(settings): make every Settings row real; archive settings, index backups and restore
Settings (UI-01, UI-02, UI-03, UI-09, RF-4): - New Import, Analysis and Formats pages, in the order of Settings.html. Import holds the defaults of new cards (session rules, subfolders, verification, duplicates, after-import actions); Analysis the deep-analysis width cap, night and star-field thresholds and deep analysis after import or scan; Formats the decode tier of every format on this PC with a notice and Store install link per missing codec extension. - Archive gains thumbnail size and rescan interval; its templates, proxy size and thumbnail size are the open archive's own (archive.json) and new archives' defaults. - Rendering quality, parallelism and background priority now drive the jobs: quality maps to preparation size, read-ahead and default flow quality; parallelism sets the engine's workers live and caps per-job threads; background priority raises the UI thread while Titano is in front. - Advanced gains Restore (daily backups, dry-run summary, destructive confirmation, staged for the next start) and Reset all. - The naming preview's sample title is a catalog string. Engine (ENG-03, ENG-04, ENG-06): - ArchiveService.GetSettingsAsync/UpdateSettingsAsync rewrite archive.json atomically under a lease, then the index row; the server endpoint and the desktop use them, and the desktop creates archives with Settings › Archive. ThumbnailPolicy in archive.json sizes the thumbnails. - DatabaseBackups: daily VACUUM INTO copies kept x3 on the desktop and on a server on SQLite (DatabaseBackupService), staged restore checked and preceded by a fresh copy. - Maintenance vacuums the SQLite index when 10 % or more is free (dry run reports it). - JobEngine.SetWorkers; ProcessingOptions.Tune applies host tuning per job. Archive setup toasts say why in a localized sentence (RF-1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
91 files changed
+2864
-357
No files matched your search
@@ -6,9 +6,10 @@ namespace Titano.Data.Processing;
|
||||
|
||||
/// <summary>
|
||||
/// Light analysis queued after work that brings sequences or frames into the index (card import, adoption, scan), so the
|
||||
/// advisor's Auto values and recommended preset exist without any user action (BRIEF §1.1, §4.3). Nothing is queued
|
||||
/// when the engine cannot run light analysis, and a sequence already waiting in a queued light analysis is not queued
|
||||
/// again (that job runs after the changes that led here).
|
||||
/// advisor's Auto values and recommended preset exist without any user action (BRIEF §1.1, §4.3); a background deep
|
||||
/// analysis too when the host asks for it. Nothing is queued when the engine cannot run the analysis, and a sequence
|
||||
/// already waiting in a queued analysis of the same kind is not queued again (that job runs after the changes that led
|
||||
/// here).
|
||||
/// </summary>
|
||||
internal static class AnalysisFollowUp
|
||||
{
|
||||
@@ -24,6 +25,21 @@ internal static class AnalysisFollowUp
|
||||
await context.EnqueueFollowUpAsync(request.Kind, request.Targets, request.Label, request.ParametersJson, request.Priority).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queues one background deep analysis of <paramref name="sequenceIds"/> (BRIEF §10.2: background, low priority),
|
||||
/// leaving out the sequences a queued deep analysis already covers.
|
||||
/// </summary>
|
||||
public static async Task QueueDeepAsync(TitanoDatabase db, JobContext context, IReadOnlyCollection<Guid> sequenceIds)
|
||||
{
|
||||
if (sequenceIds.Count == 0) return;
|
||||
var waiting = (await db.Jobs.ListQueuedAsync([JobKind.DeepAnalyse], 1000, context.Cancellation).ConfigureAwait(false))
|
||||
.SelectMany(j => j.TargetIds).ToHashSet();
|
||||
var targets = sequenceIds.Where(id => !waiting.Contains(id)).Distinct().ToList();
|
||||
if (targets.Count == 0) return;
|
||||
var request = ProcessingJobs.DeepAnalysis(targets, context.Job.TargetLabel) with { Priority = JobPriority.Background };
|
||||
await context.EnqueueFollowUpAsync(request.Kind, request.Targets, request.Label, request.ParametersJson, request.Priority).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>Sequences of <paramref name="archiveId"/> without a current light analysis (new, adopted, or with frames a scan added).</summary>
|
||||
public static async Task<List<Guid>> UnanalysedAsync(TitanoDatabase db, Guid archiveId, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -62,6 +62,17 @@ public sealed record ProcessingOptions
|
||||
|
||||
public RenderOptions Render { get; init; } = RenderOptions.Default;
|
||||
|
||||
/// <summary>
|
||||
/// The host's current tuning, asked at the start of every analysis and render: it returns these options with the
|
||||
/// values the user may change at any time (on the desktop Settings › Rendering and Analysis: memory budget, quality
|
||||
/// profile, parallelism, analysis width and thresholds), so a change applies to the next job. Null: these options as
|
||||
/// they are.
|
||||
/// </summary>
|
||||
public Func<ProcessingOptions, ProcessingOptions>? Tune { get; init; }
|
||||
|
||||
/// <summary>These options with the host's current tuning (<see cref="Tune"/>).</summary>
|
||||
internal ProcessingOptions Current => Tune?.Invoke(this) ?? this;
|
||||
|
||||
/// <summary>Tells <see cref="SequenceChanged"/>; a failure is logged, never passed on to the job.</summary>
|
||||
internal async Task NotifyAsync(Guid sequenceId, string change, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -104,10 +104,13 @@ internal sealed class SequenceAnalyser(TitanoDatabase db, ProcessingOptions opti
|
||||
IProgress<AnalysisProgress>? progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var file = new DeepAnalysisCheckpointFile(Path.Combine(folder.MetaDirectory, DeepAnalysisCheckpointFile.FileName));
|
||||
// The host's analysis parameters as they are now (Settings › Analysis on the desktop). Those that change per-frame
|
||||
// results are part of the checkpoint's fingerprint, so a partial run made with other values starts again.
|
||||
var analysis = options.Current.DeepAnalysis;
|
||||
DeepAnalysisReport report;
|
||||
await using (var source = new SequenceFrameSource(frames, metadata, options.Archive.Decoder))
|
||||
{
|
||||
report = await DeepAnalyzer.AnalyzeAsync(source, options.DeepAnalysis, new FramesCheckpoint(file, ContentKey(frames)), progress, cancellationToken)
|
||||
report = await DeepAnalyzer.AnalyzeAsync(source, analysis, new FramesCheckpoint(file, ContentKey(frames)), progress, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
report.Save(folder.AnalysisPath);
|
||||
|
||||
@@ -32,6 +32,8 @@ internal sealed class SequenceRender : IAsyncDisposable
|
||||
/// <param name="analysis">The sequence's deep report, when current: its luminance spares the preparation a decode pass.</param>
|
||||
public SequenceRender(SequenceFrames frames, ProjectSettings project, DeepAnalysisReport? analysis, ProcessingOptions options)
|
||||
{
|
||||
// The host's tuning as it is now (memory budget, quality profile): a change applies from the next render.
|
||||
options = options.Current;
|
||||
var metadata = frames.LightFrames();
|
||||
_source = new SequenceFrameSource(frames, metadata, options.Archive.Decoder, options.FrameWindow);
|
||||
_processing = options;
|
||||
|
||||
Reference in new issue
Block a user