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

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:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-05 09:18:40 +01:00
1 parent 188b2c2e55
commit 728ffa35cb
729 files changed
+26954 -1652

No files matched your search

@@ -62,7 +62,13 @@ internal sealed class WorkspaceRenderJobHandler(ChronosDatabase db, ArchiveServi
var exports = project.ExportsDirectory;
Directory.CreateDirectory(exports);
using var names = new OutputNames();
var all = RenderJobHandler.Targets(projectSettings.Export, render.PresetName);
// A still saves one frame through the job's preset alone: a batch is a video's.
var all = render.IsStill
? [new ExportTarget(ExportResolver.Resolve(projectSettings.Export), render.PresetName)]
: RenderJobHandler.Targets(projectSettings.Export, render.PresetName);
var still = render.IsStill
? SequenceRender.StillIndex(frames, render.StillFrame, render.StillPhoto) ?? throw new InvalidOperationException(Loc.L("Export.Render.StillMissing"))
: -1;
var resume = RenderCheckpoint.Parse(context.Checkpoint);
var done = resume.Done.ToList();
var ledger = project.ReadRenders();
@@ -90,34 +96,67 @@ internal sealed class WorkspaceRenderJobHandler(ChronosDatabase db, ArchiveServi
try
{
await using var renderer = new SequenceRender(frames, projectSettings, inputs.Analysis, options.Processing, originals: true, companions: null);
outcomes = await renderer.RenderAllAsync(
targets,
(target, setup) => names.Reserve(taken => ExportNaming.OutputPath(projectSettings.Export, exports, SequenceRender.NameContext(sequence, target, setup),
name => taken(name) || ledger.Entries.Any(e => SamePath(project.ExportFile(e.File), name)))),
(index, path) =>
// A name the ledger holds is taken too (an output sent home and deleted here keeps its entry).
bool Taken(Func<string, bool> taken, string name) => taken(name) || ledger.Entries.Any(e => SamePath(project.ExportFile(e.File), name));
ValueTask Starting(int index, string path)
{
writing = path;
return context.CheckpointAsync(new RenderCheckpoint(done, index, path).ToJson(), context.Done, context.Total);
}
async ValueTask Record(int index, ExportTarget target, RenderResult result)
{
// The output is complete: recorded even if the job is being cancelled, so it is never orphaned.
var id = RenderJobHandler.RenderId(context.Job.Id, index);
var entry = await EntryAsync(project, context.Job.Id, id, target, result, versionId, settingsHash).ConfigureAwait(false);
if (render.IsStill) entry = entry with { Fps = 0, DurationSeconds = 0, Kind = RenderKind.Still };
using (await project.LockAsync(LockWait, CancellationToken.None).ConfigureAwait(false))
{
writing = path;
return context.CheckpointAsync(new RenderCheckpoint(done, index, path).ToJson(), context.Done, context.Total);
},
async (index, target, result) =>
ledger = project.ReadRenders().With(entry);
project.WriteRenders(ledger);
}
done.Add(index);
if (!recorded.Contains(id)) recorded.Add(id);
writing = null;
await context.CheckpointAsync(new RenderCheckpoint(done, null, null).ToJson(), context.Done, context.Total).ConfigureAwait(false);
context.Log(render.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);
}
if (render.IsStill)
{
var (index, target) = targets[0];
try
{
// The output is complete: recorded even if the job is being cancelled, so it is never orphaned.
var id = RenderJobHandler.RenderId(context.Job.Id, index);
var entry = await EntryAsync(project, context.Job.Id, id, target, result, versionId, settingsHash).ConfigureAwait(false);
using (await project.LockAsync(LockWait, CancellationToken.None).ConfigureAwait(false))
{
ledger = project.ReadRenders().With(entry);
project.WriteRenders(ledger);
}
done.Add(index);
if (!recorded.Contains(id)) recorded.Add(id);
writing = null;
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);
},
context.ReportAsync,
cancellation).ConfigureAwait(false);
var result = await renderer.RenderStillAsync(
target,
still,
setup => names.Reserve(taken => SequenceRender.StillPath(projectSettings.Export, exports, SequenceRender.NameContext(sequence, target, setup), still,
name => Taken(taken, name))),
path => Starting(index, path),
context.ReportAsync,
cancellation).ConfigureAwait(false);
await Record(index, target, result).ConfigureAwait(false);
outcomes = [new TargetOutcome(target, result, null)];
}
catch (Exception ex) when (!(ex is OperationCanceledException && cancellation.IsCancellationRequested))
{
Core.Diagnostics.Log.Warning("workspace", $"The still of frame {still + 1} of {sequence.DisplayTitle} failed", ex);
outcomes = [new TargetOutcome(target, null, SequenceRender.Reason(ex))];
}
}
else
{
outcomes = await renderer.RenderAllAsync(
targets,
(target, setup) => names.Reserve(taken => ExportNaming.OutputPath(projectSettings.Export, exports, SequenceRender.NameContext(sequence, target, setup),
name => Taken(taken, name))),
Starting,
Record,
context.ReportAsync,
cancellation).ConfigureAwait(false);
}
if (renderer.StandIns.Count > 0)
context.Log(Loc.L("Export.Log.StandIns", string.Join(", ", renderer.StandIns.Select(i => (i + 1).ToString(Loc.Culture)))));
}
@@ -25,6 +25,7 @@ namespace Chronos.Data.Workspaces;
/// <param name="State"><see cref="Pending"/>, <see cref="SentState"/> or <see cref="Failed"/> (a later Chronos may write others: read as pending).</param>
/// <param name="Sent">When the home took it; null until then.</param>
/// <param name="Error">Why the last send failed (one localized sentence); null otherwise.</param>
/// <param name="Kind">The render's kind (<see cref="RenderKind"/>): <c>still</c> for a saved frame, null for a video or an image sequence.</param>
public sealed record WorkspaceRenderEntry(
Guid RenderId,
Guid JobId,
@@ -43,7 +44,8 @@ public sealed record WorkspaceRenderEntry(
DateTimeOffset Rendered,
string State = WorkspaceRenderEntry.Pending,
DateTimeOffset? Sent = null,
string? Error = null)
string? Error = null,
string? Kind = null)
{
/// <summary>Written, not at the home yet.</summary>
public const string Pending = "pending";
@@ -286,6 +286,9 @@ internal sealed class WorkspaceSendJobHandler(ChronosDatabase db, ArchiveService
ProducedBy = options.Processing.ProducedBy,
ProjectId = entry.ProjectId,
ProjectVersionId = entry.ProjectVersionId,
// A file's hash is the file's own (an image sequence's ledger hash is of its listing, not a render's).
Sha256 = folder ? null : entry.Sha256.ToLowerInvariant(),
Kind = entry.Kind,
}, ct).ConfigureAwait(false);
return filed is not null ? true : throw new InvalidOperationException(Loc.L("Errors.Archive.FolderMoved"));
}
@@ -329,7 +332,7 @@ internal sealed class WorkspaceSendJobHandler(ChronosDatabase db, ArchiveService
{
var name = SyncTransfers.SafeFileName(Path.GetFileName(entry.File)) ?? entry.RenderId.ToString("N");
var request = new RenderUploadRequest(entry.RenderId, name, entry.Size, entry.Sha256.ToLowerInvariant(), entry.PresetName, entry.Codec, entry.Width, entry.Height,
entry.Fps, entry.DurationSeconds, options.Processing.ProducedBy, entry.ProjectId, entry.ProjectVersionId);
entry.Fps, entry.DurationSeconds, options.Processing.ProducedBy, entry.ProjectId, entry.ProjectVersionId, entry.Kind);
try
{
if (await remote.UploadRenderAsync(sequenceId, file, request, ct).ConfigureAwait(false) is not { } filed) return false;