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
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:
1 parent
7e4a3b481d
commit
efa87f68ce
354 files changed
+24530
-843
No files matched your search
@@ -425,6 +425,8 @@
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Verify}" Command="{Binding VerifySetCommand}" ToolTip="{Binding VerifySetToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Reorganize}" Command="{Binding ReorganizeSetCommand}"
|
||||
ToolTip="{Binding ReorganizeSetToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Convert}" Command="{Binding ConvertSetCommand}"
|
||||
ToolTip="{Binding ConvertSetToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Retag}" Command="{Binding RetagSetCommand}" ToolTip="{Binding RetagSetToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Export}" Command="{Binding ExportSetCommand}" ToolTip="{Binding ExportSetToolTip}" />
|
||||
</WrapPanel>
|
||||
@@ -438,7 +440,7 @@
|
||||
</ui:EmptyState>
|
||||
</Grid>
|
||||
|
||||
<!-- In-window dialogs (rebuild, rename, retag, trash) over a scrim; the keyboard stays inside the dialog. -->
|
||||
<!-- In-window dialogs (rebuild, reorganize, convert, retag, trash) over a scrim; the keyboard stays inside the dialog. -->
|
||||
<Grid Visibility="{Binding IsDialogOpen, Converter={StaticResource BoolToVisibility}}" KeyboardNavigation.TabNavigation="Cycle"
|
||||
KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
|
||||
<Border Background="{DynamicResource Brush.Scrim}" />
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Chronos.App.Sections;
|
||||
/// <summary>
|
||||
/// Archive manager (BRIEF §12.5, Archive.html): the archive's tree (years, sequences) with its availability, its
|
||||
/// figures and charts, mass operations on the selected and filtered set (analyse, proxies, thumbnails, verify,
|
||||
/// reorganize, retag, CSV, delete into the trash), and the operations on the whole archive as jobs (scan, rebuild with its
|
||||
/// reorganize, convert, retag, CSV, delete into the trash), and the operations on the whole archive as jobs (scan, rebuild with its
|
||||
/// dialog, verify, maintenance), the trash, plus the maintenance view: index health, duplicates and orphans with safe
|
||||
/// fixes, recent runs. The
|
||||
/// tree selection is only ever changed by the user: reloads and expanding keep it.
|
||||
@@ -110,6 +110,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
ThumbnailsSetCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ArchiveJobs.Thumbnails(ids, SetLabel()), Set()), HasSet);
|
||||
VerifySetCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ArchiveJobs.Verify(_archive!, ids), Set()), HasSet);
|
||||
ReorganizeSetCommand = new AsyncRelayCommand(() => OpenReorganizeDialogAsync(), () => HasSet() && IsOnline());
|
||||
ConvertSetCommand = new AsyncRelayCommand(() => OpenConvertDialogAsync(), () => HasSet() && IsOnline());
|
||||
RetagSetCommand = new RelayCommand(OpenRetag, () => HasSet() && IsOnline());
|
||||
ExportSetCommand = new AsyncRelayCommand(ExportAsync, HasSet);
|
||||
DeleteSetCommand = new AsyncRelayCommand(DeleteSetAsync, () => HasSet() && IsOnline());
|
||||
@@ -179,6 +180,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
public string VerifySetToolTip => WhenSet("Tooltips.Archive.SetVerify");
|
||||
public string ExportSetToolTip => WhenSet("Tooltips.Archive.SetExport");
|
||||
public string ReorganizeSetToolTip => WhenSet("Tooltips.Archive.SetReorganize", needsOnline: true);
|
||||
public string ConvertSetToolTip => WhenSet("Tooltips.Archive.SetConvert", needsOnline: true);
|
||||
public string RetagSetToolTip => WhenSet("Tooltips.Archive.SetRetag", needsOnline: true);
|
||||
public string DeleteSetToolTip => WhenSet("Tooltips.Archive.SetDelete", needsOnline: true);
|
||||
|
||||
@@ -282,6 +284,9 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
/// <summary>Reorganize…: the set's folders, file names and titles from templates, a dry run first, then a job.</summary>
|
||||
public ICommand ReorganizeSetCommand { get; }
|
||||
|
||||
/// <summary>Convert…: the set's photos to JPEG, 16-bit TIFF or linear DNG, Replace or New sequence, a dry run first, then a job.</summary>
|
||||
public ICommand ConvertSetCommand { get; }
|
||||
|
||||
public ICommand RetagSetCommand { get; }
|
||||
public ICommand ExportSetCommand { get; }
|
||||
|
||||
@@ -364,7 +369,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
|
||||
// ---------------- Dialogs ----------------
|
||||
|
||||
/// <summary>The open in-window dialog (rebuild, reorganize, retag, delete, trash); null when none.</summary>
|
||||
/// <summary>The open in-window dialog (rebuild, reorganize, convert, retag, delete, trash); null when none.</summary>
|
||||
public ArchiveDialogViewModel? Dialog
|
||||
{
|
||||
get => _dialog;
|
||||
@@ -634,6 +639,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
OnPropertyChanged(nameof(VerifySetToolTip));
|
||||
OnPropertyChanged(nameof(ExportSetToolTip));
|
||||
OnPropertyChanged(nameof(ReorganizeSetToolTip));
|
||||
OnPropertyChanged(nameof(ConvertSetToolTip));
|
||||
OnPropertyChanged(nameof(RetagSetToolTip));
|
||||
OnPropertyChanged(nameof(DeleteSetToolTip));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
@@ -680,7 +686,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
{
|
||||
if (job.State is not (JobState.Done or JobState.Failed)) return;
|
||||
if (job.Kind is not (JobKind.Scan or JobKind.Rebuild or JobKind.Verify or JobKind.Maintenance or JobKind.Import or JobKind.Proxies or JobKind.Thumbs
|
||||
or JobKind.LightAnalyse or JobKind.DeepAnalyse or JobKind.Move)) return;
|
||||
or JobKind.LightAnalyse or JobKind.DeepAnalyse or JobKind.Move or JobKind.Convert)) return;
|
||||
System.Windows.Application.Current?.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (_archive is not { } archive || !job.TargetIds.Any(id => id == archive.Id || _sequenceIds.Contains(id))) return;
|
||||
@@ -805,6 +811,16 @@ public sealed class ArchiveViewModel : SectionViewModel
|
||||
await OpenReorganizeAllAsync(await FreshAsync(waiting.Archive), waiting.Parts);
|
||||
}
|
||||
|
||||
/// <summary>Opens Convert on the set and waits for its dry run (the archival format, no mode chosen yet).</summary>
|
||||
public async Task OpenConvertDialogAsync()
|
||||
{
|
||||
if (Services.Archives is not { } archives || Services.Engine is not { } engine || _archive is not { } archive) return;
|
||||
IReadOnlyList<Guid> set = [.. Set().Select(s => s.Id)];
|
||||
var dialog = new ConvertDialogViewModel(archives, archive, set, r => EnqueueAsync(engine, r), Services.Dialogs.Confirm, CloseDialog);
|
||||
OpenDialog(dialog);
|
||||
await dialog.PlanAsync();
|
||||
}
|
||||
|
||||
/// <summary>The archive's record as the index holds it now; <paramref name="archive"/> when it cannot be read.</summary>
|
||||
private async Task<Core.Model.Archive> FreshAsync(Core.Model.Archive archive)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Jobs;
|
||||
using Chronos.App.Library;
|
||||
@@ -318,12 +319,14 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
/// <summary>
|
||||
/// The toast of a job that ended, with one action (BRIEF §12.1, §0.2 rule 6). Several endings at once (a batch
|
||||
/// finished, or failed together) say how many and lead to this screen. Clicking the Windows notification of a
|
||||
/// toast opens what it names; a retry waits until the user has seen why the job failed.
|
||||
/// toast opens what it names; a retry waits until the user has seen why the job failed. Conversions that replaced photos
|
||||
/// offer Undo instead (<see cref="ConvertUndo"/>), which never runs from the Windows notification.
|
||||
/// </summary>
|
||||
private Toast ToastFor(JobEnding ending)
|
||||
{
|
||||
var job = ending.Jobs[0];
|
||||
var failed = ending.Notice == JobNotice.Failed;
|
||||
if (!failed && ending.Jobs.All(ConvertUndo.Replaces)) return ConvertUndo.Toast(Shell, ending.Jobs);
|
||||
if (ending.Jobs.Count > 1)
|
||||
{
|
||||
return new Toast
|
||||
|
||||
@@ -423,6 +423,7 @@
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Reorganize}" Command="{Binding ReorganizeCommand}" ToolTip="{Binding ReorganizeToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Convert}" Command="{Binding ConvertCommand}" ToolTip="{Binding ConvertToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Upload}" Command="{Binding UploadCommand}" ToolTip="{Binding UploadToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.Download}" Command="{Binding DownloadCommand}" ToolTip="{Binding DownloadToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Library.Action.ExportList}" Command="{Binding ExportListCommand}" ToolTip="{Binding ExportListToolTip}" />
|
||||
@@ -435,7 +436,7 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- In-window dialogs (tags, move, view name, delete) over a scrim; the keyboard stays inside the dialog. -->
|
||||
<!-- In-window dialogs (tags, reorganize, convert, view name, delete) over a scrim; the keyboard stays inside the dialog. -->
|
||||
<Grid Visibility="{Binding IsDialogOpen, Converter={StaticResource BoolToVisibility}}" KeyboardNavigation.TabNavigation="Cycle"
|
||||
KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
|
||||
<Border Background="{DynamicResource Brush.Scrim}" />
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -163,7 +163,22 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
|
||||
if (filter.Text is not null || Wanted is not { } wanted || Items.Any(i => i.Id == wanted)) return;
|
||||
if (await db.Sequences.GetAsync(wanted) is null && Shell.Library.RemoteSequences.All(s => s.Id != wanted)) return;
|
||||
while (generation == _generation && _pager is { HasMore: true } pager && Items.All(i => i.Id != wanted))
|
||||
await ApplyAsync(pager.LoadMoreAsync(), first: false);
|
||||
{
|
||||
if (pager.IsLoading)
|
||||
{
|
||||
// The list asked for a page as it scrolled: wait for that one. Asking again gets nothing at once, and this
|
||||
// loop would spin on the UI thread, which that page needs to finish.
|
||||
var loaded = pager.WhenLoadedAsync();
|
||||
if (loaded.IsCompleted) break;
|
||||
await loaded;
|
||||
await Task.Yield();
|
||||
continue;
|
||||
}
|
||||
var next = pager.LoadMoreAsync();
|
||||
await ApplyAsync(next, first: false);
|
||||
// Nothing came (the filter changed, the page failed): stop rather than ask again and again.
|
||||
if (!next.IsCompletedSuccessfully || next.Result is null) break;
|
||||
}
|
||||
if (generation == _generation) Preselect();
|
||||
}
|
||||
|
||||
|
||||
@@ -1176,7 +1176,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
[
|
||||
JobKind.Render, JobKind.Import, JobKind.Download, JobKind.UploadCommit, JobKind.Scan, JobKind.Rebuild, JobKind.Verify, JobKind.LightAnalyse,
|
||||
JobKind.DeepAnalyse, JobKind.Thumbs, JobKind.Proxies, JobKind.Maintenance, JobKind.Duplicates, JobKind.Orphans, JobKind.Adopt, JobKind.Move,
|
||||
JobKind.Backup, JobKind.Cleanup, JobKind.EmptyTrash,
|
||||
JobKind.Backup, JobKind.Cleanup, JobKind.EmptyTrash, JobKind.Convert,
|
||||
];
|
||||
|
||||
/// <summary>Stores <paramref name="level"/> for <paramref name="kind"/>, keeping only the levels that differ from the defaults.</summary>
|
||||
|
||||
Reference in new issue
Block a user