feat(archive): convert sequences to JPEG, TIFF-16 or linear DNG after import
Owner review 2, R7 asks for mass conversion after import on the web panel and the desktop, with a choice at every run between Replace and New sequence. This is the engine and the server API both UIs build on. - Core/Conversion: ConvertOptions (JPEG 4:4:4 at quality 1-100, default 95; TIFF-16 sRGB Deflate with the predictor; linear DNG, the archival choice; converted names keep the stem and take the target's extension in the old one's case). FrameConverter decodes at the native tier only, encodes with the in-house writers, writes Exif from the sidecar (capture time to the tick, offset, exposure) and the original (camera, serial, lens, modes, GPS), hashes the bytes as made, writes atomically and verifies: read back, the metadata again, a decode by the server's decoders. ExifWriter now writes the exposure program, metering mode, flash and white balance. ConvertPlanner: convertible frames, skips with reasons, size estimates per pixel, the plan's space and fingerprint. - FrameTrash.ReplaceAsync swaps the files of frames in place: same ids and indices, the old files and their XMP companions into one Replaced trash entry (records, replacement hashes, a copy of analysis.json), tombstones aliasing old content to new, proxies of the swapped frames dropped, under .chronos/replace.pending.json, which the next writer undoes or completes. Restoring a Replaced entry swaps back while every converted frame is unchanged (the converted files become a Replaced entry in turn), else the originals come back as a new sequence. - MassConverter and JobKind.Convert (19): the dry run (busy, offline, unreadable, space against ArchiveServiceOptions.FreeSpace), stage A converting into staging/convert-<job>/ in parallel with each source re-hashed and each staged file appended to journal/convert-<job>.staged, stage B per sequence all or nothing under the lease at the planned frames version: Replace, or a new sequence through the ingest with the source's tags, rating, notes and project. Resumes keep verified staged files; a sequence changed, busy or with a failed photo is left as it was and fails the job at the end, the journal kept for a retry. - POST /api/v1/archive/convert: dry run with the plan, its space line and fingerprint, or a 202 convert job; formats the server cannot read at full resolution are skipped as convert_on_pc; validated, audited (archive_converted), sequenceChanged converted/created. The server measures the space volume for the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 809210d924cfc3f597ecdea26106fb3ff62d3762) (cherry picked from commit e13d4c0bb1bd9441933b6f3e5b6220e865a7228c)
This commit is contained in:
1 parent
d518e87733
commit
0e52929274
34 files changed
+3519
-32
No files matched your search
@@ -123,3 +123,49 @@ public sealed record ReorganizeStepDto(Guid SequenceId, string FromFolder, strin
|
||||
/// whole, <c>unreadable</c>, counts none), and the fingerprint the change sends back.
|
||||
/// </summary>
|
||||
public sealed record ReorganizePlanDto(IReadOnlyList<ReorganizeStepDto> Steps, int Sequences, int Files, int Kept, string Fingerprint);
|
||||
|
||||
/// <summary>
|
||||
/// <c>POST /api/v1/archive/convert</c> (owner review 2, R7; administrators of the archive): the photos of
|
||||
/// <see cref="SequenceIds"/>, or of every sequence with <see cref="All"/> (exactly one of the two), converted to
|
||||
/// <see cref="Target"/> (<c>jpeg</c>, <c>tiff16</c> or <c>linear-dng</c>, the archival choice) with <see cref="Quality"/> 1–100
|
||||
/// for a JPEG (default 95, ignored otherwise). <see cref="Mode"/>, chosen at every run: <c>replace</c> (the converted files
|
||||
/// become the frames, the originals go to the archive's trash) or <c>new-sequence</c> (copies in a new sequence, the source
|
||||
/// untouched). <see cref="DryRun"/> answers the plan (<see cref="ConvertPlanDto"/>) and changes nothing; the change itself
|
||||
/// sends that plan's <see cref="Fingerprint"/> back (409 <c>plan_changed</c> when the archive changed since) and runs as a
|
||||
/// <c>convert</c> job (202).
|
||||
/// </summary>
|
||||
public sealed record ConvertRequest(IReadOnlyList<Guid>? SequenceIds, bool All, string? Target, int? Quality, string? Mode, bool DryRun,
|
||||
string? Fingerprint = null);
|
||||
|
||||
/// <summary>
|
||||
/// Photos of a sequence a conversion leaves as they are: <see cref="Reason"/> <c>same_format</c>, <c>convert_on_pc</c> (the
|
||||
/// server cannot read them at full resolution: a CR3, a HEIC, a body its RAW decoder does not support), <c>undecodable</c>,
|
||||
/// <c>missing</c> or <c>unhashed</c> (never verified), how many, and the reason as one localised sentence.
|
||||
/// </summary>
|
||||
public sealed record ConvertSkippedDto(string Reason, int Photos, string Message);
|
||||
|
||||
/// <summary>Why a whole sequence is not converted now: <see cref="Reason"/> <c>busy</c>, <c>offline</c>, <c>unreadable</c> or <c>frames_changed</c>, as one localised sentence too.</summary>
|
||||
public sealed record ConvertBlockedDto(string Reason, string Message);
|
||||
|
||||
/// <summary>
|
||||
/// One sequence of a conversion plan: its title, folder and the frames version it was planned at, the photos converted
|
||||
/// with their size now and the estimated size after, the photos left as they are and why, and what blocks the sequence
|
||||
/// (it is then not converted).
|
||||
/// </summary>
|
||||
public sealed record ConvertSequenceDto(Guid SequenceId, string Title, string Folder, int FramesVersion, int Photos, long BytesBefore, long BytesAfter,
|
||||
IReadOnlyList<ConvertSkippedDto> Skipped, IReadOnlyList<ConvertBlockedDto> Blocked);
|
||||
|
||||
/// <summary>
|
||||
/// The space a conversion needs on the archive's volume (the estimate × 1.15 plus a 512 MiB reserve; with <c>replace</c> the
|
||||
/// originals stay in the trash, so it adds up), what is free there (null when it cannot be measured), whether it is
|
||||
/// enough, and the line the dialog shows.
|
||||
/// </summary>
|
||||
public sealed record ConvertSpaceDto(long Required, long? Free, bool Enough, string Message);
|
||||
|
||||
/// <summary>
|
||||
/// The dry run of a conversion: the target, quality and mode, each sequence asked for in order (<see cref="Steps"/>), the
|
||||
/// sequences and photos converted, the photos skipped, the bytes before and the estimate after, the space, and the
|
||||
/// fingerprint the change sends back.
|
||||
/// </summary>
|
||||
public sealed record ConvertPlanDto(string Target, int Quality, string Mode, IReadOnlyList<ConvertSequenceDto> Steps, int Sequences, int Photos, int Skipped,
|
||||
long BytesBefore, long BytesAfter, ConvertSpaceDto Space, string Fingerprint);
|
||||
@@ -89,4 +89,6 @@ namespace Chronos.Protocol;
|
||||
[JsonSerializable(typeof(LibraryFacetsDto))]
|
||||
[JsonSerializable(typeof(ReorganizeRequest))]
|
||||
[JsonSerializable(typeof(ReorganizePlanDto))]
|
||||
[JsonSerializable(typeof(ConvertRequest))]
|
||||
[JsonSerializable(typeof(ConvertPlanDto))]
|
||||
public sealed partial class ProtocolJson : JsonSerializerContext;
|
||||
Reference in new issue
Block a user