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

+5 -1
View File
@@ -17,6 +17,9 @@ namespace Chronos.Protocol;
/// server runs in a container, whose listening ports the template fixes: they are then locked, named in
/// <see cref="Locked"/> with the variable <c>DOTNET_RUNNING_IN_CONTAINER</c> unless one of their own fixes them. The
/// members added since are last and optional, so clients and panels of the shape before them keep working.
/// <see cref="VideosPath"/> (owner review 1, R9) is the folder "Copy to videos folder" copies renders into (the Docker
/// <c>/videos</c> volume), locked by <c>CHRONOS_VIDEOS_PATH</c> (<see cref="LockedBy"/> key <c>VideosPath</c>); null in a
/// response when none is set, which disables copying; in a request, null keeps it as it is and an empty text clears it.
/// </summary>
public sealed record ServerSettingsDto(
string ServerName,
@@ -42,7 +45,8 @@ public sealed record ServerSettingsDto(
bool ProxyWarning,
int? PublicHttpPort = null,
int? PublicHttpsPort = null,
bool InContainer = false);
bool InContainer = false,
string? VideosPath = null);
/// <summary>
/// The log settings of <see cref="ServerSettingsDto"/> (owner review 2, R11): the least severe level of the files and of the
@@ -423,6 +423,42 @@ public sealed class ChronosClient : IDisposable
return Convert.ToHexStringLower(hash);
}
// ---------------- Videos (owner review 1, R9; servers with the "videos" capability) ----------------
/// <summary>One page of the server's videos matching <paramref name="query"/> (every video, newest first, when null).</summary>
public Task<VideoPageDto> ListVideosAsync(VideoQueryDto? query = null, CancellationToken ct = default)
{
var q = query ?? new VideoQueryDto();
var invariant = System.Globalization.CultureInfo.InvariantCulture;
var parts = string.Concat(Q("q", q.Q), Q("kind", q.Kind), Q("codec", q.Codec), Q("year", q.Year?.ToString(invariant)), Q("sequence", q.Sequence?.ToString()),
Q("sort", q.Sort), Q("cursor", q.Cursor), Q("limit", q.Limit?.ToString(invariant)));
return GetAsync(parts.Length == 0 ? "api/v1/videos" : "api/v1/videos?" + parts[1..], ProtocolJson.Default.VideoPageDto, ct);
}
/// <summary>One video of the server; a render it does not have is a 404 <see cref="ChronosApiException"/>.</summary>
public Task<VideoDto> GetVideoAsync(Guid id, CancellationToken ct = default) => GetAsync($"api/v1/videos/{id}", ProtocolJson.Default.VideoDto, ct);
/// <summary>The dry run of deleting <paramref name="ids"/> into the trash: what goes, what stays and the plan's fingerprint; nothing moves.</summary>
public Task<VideoDeletePlanDto> PlanDeleteVideosAsync(IReadOnlyList<Guid> ids, CancellationToken ct = default) =>
SendAsync(HttpMethod.Post, "api/v1/videos/delete", new VideoDeleteRequest(ids, true), ProtocolJson.Default.VideoDeleteRequest,
ProtocolJson.Default.VideoDeletePlanDto, ct);
/// <summary>
/// Deletes <paramref name="ids"/> into the trash as planned (<paramref name="fingerprint"/> from
/// <see cref="PlanDeleteVideosAsync"/>); a plan that changed since is a 409 <c>plan_changed</c>
/// <see cref="ChronosApiException"/> and nothing moves.
/// </summary>
public Task<VideoDeletePlanDto> DeleteVideosAsync(IReadOnlyList<Guid> ids, string fingerprint, CancellationToken ct = default) =>
SendAsync(HttpMethod.Post, "api/v1/videos/delete", new VideoDeleteRequest(ids, false, fingerprint), ProtocolJson.Default.VideoDeleteRequest,
ProtocolJson.Default.VideoDeletePlanDto, ct);
/// <summary>
/// Queues the copy of <paramref name="ids"/> into the server's videos folder (a <c>video-copy</c> job); a server without a
/// videos folder answers 409 <c>videos_folder_unset</c> (<see cref="ChronosApiException"/>).
/// </summary>
public Task<VideoCopyResultDto> CopyVideosAsync(IReadOnlyList<Guid> ids, CancellationToken ct = default) =>
SendAsync(HttpMethod.Post, "api/v1/videos/copy", new VideoCopyRequest(ids), ProtocolJson.Default.VideoCopyRequest, ProtocolJson.Default.VideoCopyResultDto, ct);
// ---------------- Jobs and render nodes ----------------
public Task<Page<JobDto>> ListJobsAsync(string? state = null, string? cursor = null, CancellationToken ct = default) =>
+6
View File
@@ -36,6 +36,12 @@ public static class ServerCapabilities
/// <c>projectChanged</c> event, renders of a project version. A server without it knows only the sequence's settings.
/// </summary>
public const string Projects = "projects";
/// <summary>
/// The server keeps a videos library (owner review 1, R9): <c>/api/v1/videos</c> lists, deletes into the trash and copies
/// its renders into its videos folder. Without it a client lists only its own videos.
/// </summary>
public const string Videos = "videos";
}
/// <summary><c>GET /health</c>.</summary>
+20 -2
View File
@@ -68,14 +68,31 @@ public sealed record JobPriorityRequest(string Priority);
/// format, at least 2 when the chosen proportions change a fixed preset's size); 1 in a job of an older server. A hint for
/// routing: a node recomputes it from the settings it claims.
/// </param>
/// <param name="StillFrame">
/// A still job (owner review 1, R8, "Save frame"): the 0-based index of the sequence's frame saved as one image with
/// <paramref name="Codec"/> (<c>pngsequence</c>, <c>jpegsequence</c> or <c>tiff16sequence</c>) at the export's output size,
/// with every correction and no playback; null for a video. Such a job needs settings format 3
/// (<paramref name="RequiredSettingsFormat"/>), so an older node, which would render the whole video, never claims it.
/// </param>
/// <param name="StillPhoto">
/// The SHA-256 of the still's photo: the identity that wins over <paramref name="StillFrame"/> when both are given and the
/// frames moved since (photos inserted before it); null when the photo is not hashed yet.
/// </param>
public sealed record RenderJobParameters(string PresetName, string PresetJson, string Codec, int Width, int Height, bool UseProxies, string? SettingsJson,
Guid? ProjectId = null, Guid? ProjectVersionId = null, int RequiredSettingsFormat = 1);
Guid? ProjectId = null, Guid? ProjectVersionId = null, int RequiredSettingsFormat = 1, int? StillFrame = null, string? StillPhoto = null)
{
/// <summary>The job saves one frame as an image (<see cref="StillFrame"/> or <see cref="StillPhoto"/> set).</summary>
[System.Text.Json.Serialization.JsonIgnore]
public bool IsStill => StillFrame is not null || StillPhoto is not null;
}
/// <summary>
/// <c>POST /api/v1/nodes/{id}/jobs/{jobId}/result</c>: the finished output a node is about to upload in chunks. A
/// <c>result/complete</c> that cannot file it for now answers 503 <c>sequence_busy</c>, <c>archive_offline</c> or
/// <c>folder_moved</c> (another index moved the sequence's folder; the server's next scan finds it); the upload and the
/// job stay the node's, to be completed again.
/// <see cref="Kind"/> (owner review 1, R9): <c>still</c> for a still job's image, null for a video or an image sequence;
/// appended, so an earlier node sends none and an earlier server ignores it.
/// </summary>
public sealed record RenderResultRequest(
string FileName,
@@ -86,7 +103,8 @@ public sealed record RenderResultRequest(
int Width,
int Height,
double Fps,
double DurationSeconds);
double DurationSeconds,
string? Kind = null);
/// <summary><c>POST /api/v1/nodes/{id}/jobs/{jobId}/failed</c>: the node could not render the job.</summary>
public sealed record NodeJobFailure(string Error);
+6
View File
@@ -100,4 +100,10 @@ namespace Chronos.Protocol;
[JsonSerializable(typeof(ProjectPushResultDto))]
[JsonSerializable(typeof(ProjectFramesDto))]
[JsonSerializable(typeof(ProjectFramesStampDto))]
[JsonSerializable(typeof(VideoDto))]
[JsonSerializable(typeof(VideoPageDto))]
[JsonSerializable(typeof(VideoDeleteRequest))]
[JsonSerializable(typeof(VideoDeletePlanDto))]
[JsonSerializable(typeof(VideoCopyRequest))]
[JsonSerializable(typeof(VideoCopyResultDto))]
public sealed partial class ProtocolJson : JsonSerializerContext;
+8 -1
View File
@@ -116,6 +116,11 @@ public sealed record ProxySpec(int LongEdge, int Quality);
/// before phase 5c.
/// </param>
/// <param name="ProjectVersionId">The project version rendered; null when none is named (see <paramref name="ProjectId"/>).</param>
/// <param name="Sha256">
/// Lower-case hex SHA-256 of a single-file render (owner review 1, R9); null for an image sequence, for a render not hashed
/// yet (recorded before the server's migration 0010) and from earlier servers.
/// </param>
/// <param name="Kind">The render's kind as recorded: <c>still</c>, or null for a video or an image sequence (told apart by <paramref name="Codec"/>).</param>
public sealed record RenderDto(
Guid Id,
string PresetName,
@@ -128,7 +133,9 @@ public sealed record RenderDto(
DateTimeOffset Created,
string? ProducedBy,
Guid? ProjectId = null,
Guid? ProjectVersionId = null);
Guid? ProjectVersionId = null,
string? Sha256 = null,
string? Kind = null);
/// <summary>Aggregates for the archive dashboard and the admin panel.</summary>
/// <param name="FreeBytes">Free bytes of the space volume: the server's space path when one is set, else the archive's volume.</param>
+4 -2
View File
@@ -49,7 +49,8 @@ public sealed record CardImportReport(Guid ImportId, string Card, string State,
/// A render a workspace made on a client (phase 5c) names the project and version it was rendered from
/// (<see cref="ProjectId"/>, <see cref="ProjectVersionId"/>): the server records them with the render once it checked that
/// the project is the sequence's and the version the project's (422 <c>project_mismatch</c> otherwise). Both are optional
/// and appended: a request of an earlier client has neither, and an earlier server ignores them.
/// and appended: a request of an earlier client has neither, and an earlier server ignores them. <see cref="Kind"/> (owner
/// review 1, R9) is the render's kind (<c>still</c>, or null for a video or an image sequence), appended the same way.
/// </summary>
public sealed record RenderUploadRequest(
Guid RenderId,
@@ -64,4 +65,5 @@ public sealed record RenderUploadRequest(
double DurationSeconds,
string? ProducedBy,
Guid? ProjectId = null,
Guid? ProjectVersionId = null);
Guid? ProjectVersionId = null,
string? Kind = null);
+132
View File
@@ -0,0 +1,132 @@
namespace Chronos.Protocol;
// The videos library (owner review 1, R9): every render of the server in one list, on servers with the "videos" capability
// (ServerCapabilities.Videos). Read lists and plays, Delete moves renders into the archive's trash (restored through
// /archive/trash), Edit copies them into the server's videos folder; the panel and the desktop's Videos section use these.
/// <summary>A verified copy of a video in a videos folder (<see cref="VideoDto.Copies"/>).</summary>
/// <param name="Path">Absolute path of the copy on the host that made it.</param>
public sealed record VideoCopyDto(string Path, DateTimeOffset CopiedAt);
/// <summary>
/// <c>GET /api/v1/videos</c>, <c>GET /api/v1/videos/{id}</c>: a render with the members of <see cref="RenderDto"/>, its
/// sequence and project, whether its file is there, and its copies. The file itself is <c>GET /api/v1/renders/{id}/file</c>
/// (Range requests served, so a browser's <c>&lt;video&gt;</c> seeks).
/// </summary>
/// <param name="Kind">The library kind, never null: <c>video</c>, <c>still</c> or <c>sequence</c> (an image-sequence folder),
/// or a newer server's kind as it is (<see cref="RenderDto.Kind"/> holds the kind as recorded).</param>
/// <param name="SequenceTitle">The display title of the render's sequence.</param>
/// <param name="SequenceFirstCapture">When its first photo was taken; null when unknown.</param>
/// <param name="ProjectName">The project rendered (owner review 2, R8); null for a render of the sequence's settings.</param>
/// <param name="ProjectVersionNumber">The number of the project version rendered; null with <paramref name="ProjectName"/>.</param>
/// <param name="State"><c>ok</c>, or <c>missing</c> when its file is not where it was recorded (delete then removes only the entry).</param>
/// <param name="FileName">The file (or folder) name, for display and downloads.</param>
public sealed record VideoDto(
Guid Id,
Guid SequenceId,
string PresetName,
string? Codec,
int Width,
int Height,
double Fps,
double DurationSeconds,
long Bytes,
DateTimeOffset Created,
string? ProducedBy,
Guid? ProjectId,
Guid? ProjectVersionId,
string? Sha256,
string Kind,
string SequenceTitle,
DateTime? SequenceFirstCapture,
string? ProjectName,
int? ProjectVersionNumber,
string State,
IReadOnlyList<VideoCopyDto> Copies,
string? FileName = null);
/// <summary>The values of <see cref="VideoDto.State"/>.</summary>
public static class VideoStates
{
public const string Ok = "ok";
/// <summary>The render's file is not where it was recorded.</summary>
public const string Missing = "missing";
}
/// <summary>The <c>sort</c> values of <c>GET /api/v1/videos</c> (and of the desktop's Videos section).</summary>
public static class VideoSorts
{
/// <summary>Newest first (the default).</summary>
public const string Newest = "newest";
public const string Oldest = "oldest";
/// <summary>Largest first.</summary>
public const string Largest = "largest";
/// <summary>By sequence title, then newest first.</summary>
public const string Title = "title";
public static IReadOnlyList<string> All { get; } = [Newest, Oldest, Largest, Title];
}
/// <summary>One page of <c>GET /api/v1/videos</c>; <see cref="Next"/> is the cursor of the next page, null on the last one.</summary>
/// <param name="Total">Videos matching the filters on every page; null when the server does not count them.</param>
public sealed record VideoPageDto(IReadOnlyList<VideoDto> Items, string? Next, long? Total = null);
/// <summary>
/// The query of <c>GET /api/v1/videos</c> (<see cref="Client.ChronosClient.ListVideosAsync"/>); every member optional.
/// </summary>
/// <param name="Q">Text in the sequence title, the preset name or the file name.</param>
/// <param name="Kind"><c>video</c>, <c>still</c> or <c>sequence</c>.</param>
/// <param name="Codec">A codec name as recorded (<c>h264</c>, <c>hevc</c>, <c>pngsequence</c>…).</param>
/// <param name="Year">The year the render was made (UTC).</param>
/// <param name="Sequence">The videos of one sequence.</param>
/// <param name="Sort">One of <see cref="VideoSorts"/>; null for newest first.</param>
/// <param name="Cursor">The <see cref="VideoPageDto.Next"/> of the previous page.</param>
/// <param name="Limit">Videos per page, 1–500 (the server's default when null).</param>
public sealed record VideoQueryDto(string? Q = null, string? Kind = null, string? Codec = null, int? Year = null, Guid? Sequence = null,
string? Sort = null, string? Cursor = null, int? Limit = null);
/// <summary>
/// <c>POST /api/v1/videos/delete</c>: move these renders into the archive's trash. With <see cref="DryRun"/> the server
/// answers the plan (<see cref="VideoDeletePlanDto"/>) and moves nothing; the delete itself must send the plan's
/// <see cref="Fingerprint"/> back, or the server answers 409 <c>plan_changed</c> and moves nothing.
/// </summary>
public sealed record VideoDeleteRequest(IReadOnlyList<Guid> Ids, bool DryRun, string? Fingerprint = null);
/// <summary>A render of a delete plan: what goes, and whether only its entry goes (its file is missing).</summary>
public sealed record VideoDeleteItemDto(Guid Id, Guid SequenceId, string SequenceTitle, string? FileName, long Bytes, bool Missing);
/// <summary>
/// A render a delete leaves where it is: <see cref="Reason"/> <c>busy</c> (a send, an upload or a copy of it is running) or
/// <c>not_found</c> (no such render).
/// </summary>
public sealed record VideoBlockedDto(Guid Id, string Reason);
/// <summary>The values of <see cref="VideoBlockedDto.Reason"/>.</summary>
public static class VideoBlockReasons
{
public const string Busy = "busy";
public const string NotFound = "not_found";
}
/// <summary>
/// The answer of <c>POST /api/v1/videos/delete</c>: the renders that go (or went) to the trash, their bytes, the renders left
/// where they are, and the plan's fingerprint. Copies in the videos folder are never touched. After the delete itself
/// (<see cref="DryRun"/> false) <see cref="TrashEntries"/> names the trash entries made, each restorable with
/// <c>POST /api/v1/archive/trash/{name}/restore</c>.
/// </summary>
public sealed record VideoDeletePlanDto(IReadOnlyList<VideoDeleteItemDto> Items, long Bytes, IReadOnlyList<VideoBlockedDto> Blocked, string Fingerprint,
bool DryRun, IReadOnlyList<string>? TrashEntries = null);
/// <summary>
/// <c>POST /api/v1/videos/copy</c>: copy these renders into the server's videos folder as one <c>video-copy</c> job; 409
/// <c>videos_folder_unset</c> when the server has none.
/// </summary>
public sealed record VideoCopyRequest(IReadOnlyList<Guid> Ids);
/// <summary>The answer of <c>POST /api/v1/videos/copy</c> (202): the <c>video-copy</c> job queued.</summary>
public sealed record VideoCopyResultDto(Guid JobId);