feat: export panel and Render menu, playback options, videos library (owner review 1 phase 5) (#27)
CI / Build and test (push) Successful in 9m41s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 14m49s
CI / PostgreSQL 16 integration (push) Successful in 8m51s
CI / PostgreSQL 17 integration (push) Successful in 9m48s
CI / Docker image (push) Successful in 54s
Release / Server image (push) Successful in 1m39s
CI / Build and test (push) Successful in 9m41s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 14m49s
CI / PostgreSQL 16 integration (push) Successful in 8m51s
CI / PostgreSQL 17 integration (push) Successful in 9m48s
CI / Docker image (push) Successful in 54s
Release / Server image (push) Successful in 1m39s
Owner review 1 R3, R8, R9. A grouped Export step and Render menu; encoding, playback (reverse, boomerang, loops, fades, hold) and still frames; one videos library on the desktop and the server with a verified trash and copies to a videos folder. Closes #21 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 #27.
This commit is contained in:
1 parent
188b2c2e55
commit
728ffa35cb
729 files changed
+26954
-1652
No files matched your search
@@ -59,7 +59,11 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
var (projectId, projectVersionId) = await ProvenanceAsync(parameters, sequence, cancellation).ConfigureAwait(false);
|
||||
|
||||
using var names = new OutputNames();
|
||||
var all = Targets(export, parameters.PresetName);
|
||||
// A still saves one frame through the job's preset alone: a batch is a video's.
|
||||
var all = parameters.IsStill ? [new ExportTarget(ExportResolver.Resolve(export), parameters.PresetName)] : Targets(export, parameters.PresetName);
|
||||
var still = parameters.IsStill
|
||||
? SequenceRender.StillIndex(frames, parameters.StillFrame, parameters.StillPhoto) ?? throw new InvalidOperationException(Loc.L("Export.Render.StillMissing"))
|
||||
: -1;
|
||||
var resume = RenderCheckpoint.Parse(context.Checkpoint);
|
||||
var done = resume.Done.ToList();
|
||||
// A crash after a render row was written but before the checkpoint: that entry is finished.
|
||||
@@ -83,29 +87,46 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
await using (var render = new SequenceRender(frames, project, SequenceAnalyser.ReadReport(folder, frames), options, originals: !parameters.UseProxies,
|
||||
companions))
|
||||
{
|
||||
outcomes = await render.RenderAllAsync(
|
||||
targets,
|
||||
(target, setup) => names.Reserve(taken => ExportNaming.OutputPath(project.Export, folder.Exports, SequenceRender.NameContext(sequence, target, setup), taken)),
|
||||
(index, path) => context.CheckpointAsync(new RenderCheckpoint(done, index, path, sequence.Folder).ToJson(), context.Done, context.Total),
|
||||
async (index, target, result) =>
|
||||
async ValueTask Record(int index, ExportTarget target, RenderResult result)
|
||||
{
|
||||
// The output is complete: record it even if the job is being cancelled, so it is never orphaned. A file is
|
||||
// hashed first (owner review 1, R9: copies and restores are verified against it); an image sequence's folder is not.
|
||||
string? sha = null;
|
||||
if (File.Exists(result.OutputPath))
|
||||
{
|
||||
// The output is complete: record it even if the job is being cancelled, so it is never orphaned.
|
||||
var entity = result.ToEntity(sequence.Id, target.PresetName, settingsJson, options.ProducedBy) with
|
||||
{
|
||||
Id = RenderId(context.Job.Id, index),
|
||||
OutputPath = Stored(paths, result.OutputPath),
|
||||
ProjectId = projectId,
|
||||
ProjectVersionId = projectVersionId,
|
||||
};
|
||||
await db.Renders.InsertAsync(entity, CancellationToken.None).ConfigureAwait(false);
|
||||
done.Add(index);
|
||||
await context.CheckpointAsync(new RenderCheckpoint(done, null, null).ToJson(), context.Done, context.Total).ConfigureAwait(false);
|
||||
context.Log(Loc.L("Export.Log.Rendered", target.PresetName, Path.GetFileName(result.OutputPath)));
|
||||
foreach (var remark in SequenceRender.Remarks(result)) context.Log(remark);
|
||||
await options.NotifyAsync(sequence.Id, ProcessingOptions.RenderedChange, CancellationToken.None).ConfigureAwait(false);
|
||||
},
|
||||
context.ReportAsync,
|
||||
cancellation).ConfigureAwait(false);
|
||||
await context.ReportAsync(context.Done, context.Total, Loc.L("Export.Job.Verifying")).ConfigureAwait(false);
|
||||
sha = await ContentHash.Sha256Async(result.OutputPath, cancellationToken: CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
var entity = result.ToEntity(sequence.Id, target.PresetName, settingsJson, options.ProducedBy) with
|
||||
{
|
||||
Id = RenderId(context.Job.Id, index),
|
||||
OutputPath = Stored(paths, result.OutputPath),
|
||||
ProjectId = projectId,
|
||||
ProjectVersionId = projectVersionId,
|
||||
Sha256 = sha,
|
||||
Kind = parameters.IsStill ? RenderKind.Still : null,
|
||||
};
|
||||
if (parameters.IsStill) entity = entity with { Fps = 0, DurationSeconds = 0 };
|
||||
await db.Renders.InsertAsync(entity, CancellationToken.None).ConfigureAwait(false);
|
||||
done.Add(index);
|
||||
await context.CheckpointAsync(new RenderCheckpoint(done, null, null).ToJson(), context.Done, context.Total).ConfigureAwait(false);
|
||||
context.Log(parameters.IsStill
|
||||
? Loc.L("Export.Log.StillSaved", (still + 1).ToString(Loc.Culture), Path.GetFileName(result.OutputPath))
|
||||
: Loc.L("Export.Log.Rendered", target.PresetName, Path.GetFileName(result.OutputPath)));
|
||||
foreach (var remark in SequenceRender.Remarks(result)) context.Log(remark);
|
||||
await options.NotifyAsync(sequence.Id, ProcessingOptions.RenderedChange, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (parameters.IsStill)
|
||||
outcomes = [await StillAsync(context, render, targets[0], still, sequence, project.Export, folder, names, done, Record).ConfigureAwait(false)];
|
||||
else
|
||||
outcomes = await render.RenderAllAsync(
|
||||
targets,
|
||||
(target, setup) => names.Reserve(taken => ExportNaming.OutputPath(project.Export, folder.Exports, SequenceRender.NameContext(sequence, target, setup), taken)),
|
||||
(index, path) => context.CheckpointAsync(new RenderCheckpoint(done, index, path, sequence.Folder).ToJson(), context.Done, context.Total),
|
||||
Record,
|
||||
context.ReportAsync,
|
||||
cancellation).ConfigureAwait(false);
|
||||
if (render.StandIns.Count > 0)
|
||||
context.Log(Loc.L("Export.Log.StandIns", string.Join(", ", render.StandIns.Select(i => (i + 1).ToString(Loc.Culture)))));
|
||||
// Recorded without the job's token: what decoding found holds even if the job is cancelled meanwhile, and a
|
||||
@@ -128,6 +149,34 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
throw new InvalidOperationException(failed.Count == 1 ? failed[0].Error : Loc.L("Errors.Render.Failed", failed.Count, outcomes.Count));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The still of a still job: frame <paramref name="frame"/> saved through the job's preset under the export's name and
|
||||
/// the frame number (<see cref="SequenceRender.StillPath"/>), checkpointed and recorded like a video's output.
|
||||
/// </summary>
|
||||
private static async Task<TargetOutcome> StillAsync(JobContext context, SequenceRender render, (int Index, ExportTarget Target) entry, int frame,
|
||||
Sequence sequence, ExportSettings export, SequencePaths folder, OutputNames names, List<int> done,
|
||||
Func<int, ExportTarget, RenderResult, ValueTask> record)
|
||||
{
|
||||
var (index, target) = entry;
|
||||
try
|
||||
{
|
||||
var result = await render.RenderStillAsync(
|
||||
target,
|
||||
frame,
|
||||
setup => names.Reserve(taken => SequenceRender.StillPath(export, folder.Exports, SequenceRender.NameContext(sequence, target, setup), frame, taken)),
|
||||
path => context.CheckpointAsync(new RenderCheckpoint(done, index, path, sequence.Folder).ToJson(), context.Done, context.Total),
|
||||
context.ReportAsync,
|
||||
context.Cancellation).ConfigureAwait(false);
|
||||
await record(index, target, result).ConfigureAwait(false);
|
||||
return new TargetOutcome(target, result, null);
|
||||
}
|
||||
catch (Exception ex) when (!(ex is OperationCanceledException && context.Cancellation.IsCancellationRequested))
|
||||
{
|
||||
Core.Diagnostics.Log.Warning("processing", $"The still of frame {frame + 1} of {sequence.DisplayTitle} failed", ex);
|
||||
return new TargetOutcome(target, null, SequenceRender.Reason(ex));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The settings of the project version a job names without embedding them (owner review 2, R8); null when it names none.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user