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>
133 lines
6.8 KiB
C#
133 lines
6.8 KiB
C#
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><video></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);
|