feat: owner review 2 phase 4b: mass conversion after import (#13)
CI / Build and test (push) Failing after 3m1s
CI / PostgreSQL 16 integration (push) Skipped
CI / PostgreSQL 17 integration (push) Skipped
CI / Docker image (push) Skipped
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
Release / Build, test and publish (push) Successful in 15m31s
Release / Server image (push) Successful in 1m13s

Convert photos already in the archive to JPEG, TIFF-16 or Linear DNG, from the panel's Library and the desktop's Archive and Library. Each run asks Replace (same frames, originals to the trash, recoverable) or New sequence. A dry run lists what converts, what is skipped and why, size before and after, and free space; the job converts exactly the confirmed photos, resumes, and commits all or nothing per sequence. A conversion never changes what Chronos reads from a photo. Replaced originals are erased only on the archive's own word that their conversion is gone. Desktop TIFFs that WIC showed black or as noise now go to the managed reader; the Edit picker no longer spins a core.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #13.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-03 10:41:50 +01:00
1 parent 7e4a3b481d
commit efa87f68ce
354 files changed
+24530 -843

No files matched your search

+29 -3
View File
@@ -130,6 +130,7 @@ public sealed class LibraryViewModel : SectionViewModel
TagCommand = Mass(MassAction.Tag, OpenRetag);
RateCommand = new AsyncRelayCommand((p, _) => p is int rating ? RateAsync(rating) : Task.CompletedTask, _ => CanRun(MassAction.Rate));
ReorganizeCommand = Mass(MassAction.Reorganize, OpenReorganizeAsync);
ConvertCommand = Mass(MassAction.Convert, OpenConvertAsync);
UploadCommand = Mass(MassAction.Upload, _ => TransferAsync(MassAction.Upload));
DownloadCommand = Mass(MassAction.Download, _ => TransferAsync(MassAction.Download));
DeleteCommand = Mass(MassAction.Delete, t => DeleteAsync([.. t.Select(s => s.Id)]));
@@ -182,6 +183,9 @@ public sealed class LibraryViewModel : SectionViewModel
/// <summary>Reorganize…: the selection's folders, file names and titles from templates, a dry run first, then a job.</summary>
public ICommand ReorganizeCommand { get; }
/// <summary>Convert…: the selection's photos to JPEG, 16-bit TIFF or linear DNG, a dry run first, then a job.</summary>
public ICommand ConvertCommand { get; }
public ICommand UploadCommand { get; }
public ICommand DownloadCommand { get; }
public ICommand DeleteCommand { get; }
@@ -492,6 +496,7 @@ public sealed class LibraryViewModel : SectionViewModel
public string TagToolTip => MassToolTip(MassAction.Tag);
public string RateToolTip => MassToolTip(MassAction.Rate);
public string ReorganizeToolTip => MassToolTip(MassAction.Reorganize);
public string ConvertToolTip => MassToolTip(MassAction.Convert);
public string UploadToolTip => MassToolTip(MassAction.Upload);
public string DownloadToolTip => MassToolTip(MassAction.Download);
public string DeleteToolTip => MassToolTip(MassAction.Delete);
@@ -509,7 +514,7 @@ public sealed class LibraryViewModel : SectionViewModel
// ---------------- Dialogs ----------------
/// <summary>The open in-window dialog (tags, reorganize, view name, delete); null when none.</summary>
/// <summary>The open in-window dialog (tags, reorganize, convert, view name, delete); null when none.</summary>
public ArchiveDialogViewModel? Dialog
{
get => _dialog;
@@ -1035,6 +1040,7 @@ public sealed class LibraryViewModel : SectionViewModel
OnPropertyChanged(nameof(TagToolTip));
OnPropertyChanged(nameof(RateToolTip));
OnPropertyChanged(nameof(ReorganizeToolTip));
OnPropertyChanged(nameof(ConvertToolTip));
OnPropertyChanged(nameof(UploadToolTip));
OnPropertyChanged(nameof(DownloadToolTip));
OnPropertyChanged(nameof(DeleteToolTip));
@@ -1068,7 +1074,8 @@ public sealed class LibraryViewModel : SectionViewModel
foreach (var item in Items.Where(i => job.TargetIds.Contains(i.Id))) item.IsAnalysing = _analysing.Contains(item.Id);
}
OpenWhenCached(job);
if (job.State == JobState.Done) _ = RefreshTargetsAsync(job);
// A conversion that failed for some sequences converted the others.
if (job.State == JobState.Done || job is { Kind: JobKind.Convert, State: JobState.Failed }) _ = RefreshTargetsAsync(job);
}
/// <summary>A remote card's "Open" waited for this proxy download; it opens if the Library is still in front.</summary>
@@ -1089,7 +1096,8 @@ public sealed class LibraryViewModel : SectionViewModel
if (await _db.Sequences.GetAsync(item.Id) is { } fresh) item.Update(fresh);
}
// Downloads of proxies only fill the proxy cache, so the Library is read again for originals and exports only.
if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit
// A conversion makes new sequences, or changes the formats and sizes of the converted ones.
if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit or JobKind.Convert
|| SyncService.TransferKind(job) is SyncTransferKind.DownloadOriginals or SyncTransferKind.GetExports)
await RefreshAsync();
else if (job.Kind is JobKind.LightAnalyse or JobKind.DeepAnalyse)
@@ -1188,6 +1196,24 @@ public sealed class LibraryViewModel : SectionViewModel
await dialog.PlanAsync();
}
/// <summary>
/// Convert…: the selection of one archive to JPEG, 16-bit TIFF or linear DNG, Replace or New sequence chosen in the
/// dialog, a dry run first, then the engine's job, which the Library follows to read the sequences again.
/// </summary>
private async Task OpenConvertAsync(IReadOnlyList<Sequence> targets)
{
if (Shell.Services.Archives is not { } archives || Shell.Services.Engine is not { } engine || _db is null || targets.Count == 0) return;
if (await _db.Archives.GetAsync(targets[0].ArchiveId) is not { } archive) return;
var dialog = new ConvertDialogViewModel(archives, archive, [.. targets.Select(t => t.Id)], async request =>
{
await engine.EnqueueAsync(request);
Shell.Notify(Loc.L("Library.Queued", JobText.Kind(request.Kind), request.Label ?? archive.Name), actionText: Loc.L("Shell.Nav.Jobs"),
actionToolTip: Loc.L("Tooltips.Nav.Jobs"), action: () => Shell.Navigate(SectionKey.Jobs));
}, Shell.Services.Dialogs.Confirm, CloseDialog);
OpenDialog(dialog);
await dialog.PlanAsync();
}
private async Task AppliedAsync(int changed)
{
Shell.Notify(Loc.Plural("Archive.Applied", changed));