feat: phase 5 groundwork (playback format 3, videos contracts, migration 0010, strings)
Lays down every contract the later parcels of owner review 1 phase 5 build on, so they compile against shared types without touching each other's files. - Settings format 3: export.playback (direction, loops, fades, hold), omitted at its default and member by member; RequiredFormat is 3 only while used. - OutputProgram public API with a forward-only body; still-frame job parameters (StillFrame, StillPhoto) routed to format-3 nodes only. - Render.Sha256/Kind, RenderCopy, RenderKind; JobKind.VideoCopy = 24. - Migration 0010 (sqlite, postgres): renders.sha256/kind, ix_renders_created, render_copies without a foreign key. - Videos protocol DTOs, client calls, ServerCapabilities.Videos (declared, not announced yet), ServerSettingsDto.VideosPath. - IVideoLibrary with a NotImplemented stub registered on the server; TrashKind.Videos, VideoTrashNames, VideoErrors. - en and it strings for the whole phase, five icons, decisions 1-22 and the open-question defaults; tests that used format 3 as "newer" now use 4. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
86aa07c1d7
commit
d472dfdec1
67 files changed
+2233
-244
No files matched your search
@@ -101,6 +101,7 @@ public static class SyncText
|
||||
["export.nameTemplate"] = "Server.Setting.OutputName",
|
||||
["export.folder"] = "Server.Setting.ExportFolder",
|
||||
["export.batch"] = "Server.Setting.Batch",
|
||||
["export.playback"] = "Server.Setting.Playback",
|
||||
["excludedFrames"] = "Server.Setting.ExcludedFrames",
|
||||
["heroFrame"] = "Server.Setting.HeroFrame",
|
||||
};
|
||||
|
||||
@@ -164,6 +164,75 @@ public sealed record Render
|
||||
|
||||
/// <summary>The project version rendered; null for a render of the sequence's settings.</summary>
|
||||
public Guid? ProjectVersionId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Lower-case hex SHA-256 of a single-file render (owner review 1, R9), hashed when it is recorded; null for an image
|
||||
/// sequence's folder (verified file by file when copied) and for a render recorded before migration 0010, hashed the
|
||||
/// first time it is copied, deleted or restored.
|
||||
/// </summary>
|
||||
public string? Sha256 { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// What the render is beyond its codec (<see cref="RenderKind"/>): null for a video or an image sequence (told apart by
|
||||
/// <see cref="Codec"/>), <see cref="RenderKind.Still"/> for one frame saved as an image. A text, so a newer Chronos can add
|
||||
/// kinds.
|
||||
/// </summary>
|
||||
public string? Kind { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>The values of <see cref="Render.Kind"/> and of the videos library's kinds (owner review 1, R9).</summary>
|
||||
public static class RenderKind
|
||||
{
|
||||
/// <summary>A video file (MP4, AVI, GIF, APNG): <see cref="Render.Kind"/> null and a video codec.</summary>
|
||||
public const string Video = "video";
|
||||
|
||||
/// <summary>A folder of numbered images: <see cref="Render.Kind"/> null and an image-sequence codec.</summary>
|
||||
public const string Sequence = "sequence";
|
||||
|
||||
/// <summary>One frame saved as one image ("Save frame"): fps 0 and duration 0.</summary>
|
||||
public const string Still = "still";
|
||||
|
||||
/// <summary>
|
||||
/// The library kind of a render: its <see cref="Render.Kind"/> when set (a kind of a newer Chronos as it is), else
|
||||
/// <see cref="Sequence"/> for an image-sequence codec and <see cref="Video"/> otherwise.
|
||||
/// </summary>
|
||||
public static string Of(string? kind, string? codec) =>
|
||||
kind is { Length: > 0 } ? kind
|
||||
: codec is { } c && c.EndsWith("sequence", StringComparison.OrdinalIgnoreCase) ? Sequence
|
||||
: Video;
|
||||
|
||||
/// <inheritdoc cref="Of(string?, string?)"/>
|
||||
public static string Of(Render render)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(render);
|
||||
return Of(render.Kind, render.Codec);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A verified copy of a render in a videos folder (owner review 1, R9; <c>render_copies</c>): recorded once the copy matched
|
||||
/// its render. There is no link to <c>renders</c>, so the copy of a server render downloaded to a PC is recorded too, and a
|
||||
/// copy outlives its render's deletion (copies are the user's files; Chronos never deletes them).
|
||||
/// </summary>
|
||||
public sealed record RenderCopy
|
||||
{
|
||||
public required Guid Id { get; init; }
|
||||
|
||||
/// <summary>The render copied (of this index, or of the server it was downloaded from).</summary>
|
||||
public required Guid RenderId { get; init; }
|
||||
|
||||
/// <summary>Absolute path of the copy (a file, or a folder for an image sequence).</summary>
|
||||
public required string Path { get; init; }
|
||||
|
||||
/// <summary>Lower-case hex SHA-256 the copy was verified against; null for an image sequence's folder (verified per file).</summary>
|
||||
public string? Sha256 { get; init; }
|
||||
|
||||
public long Bytes { get; init; }
|
||||
|
||||
public DateTimeOffset CopiedAt { get; init; }
|
||||
|
||||
/// <summary>The user (server) or the PC (desktop) that copied it.</summary>
|
||||
public string? CopiedBy { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -123,6 +123,12 @@ public enum JobKind
|
||||
/// source kept until every file is verified (owner review 2, R8, phase 5c); stored as 23.
|
||||
/// </summary>
|
||||
WorkspaceMove = 23,
|
||||
|
||||
/// <summary>
|
||||
/// Copies renders into the videos folder (owner review 1, R9), each copy hash-verified against its render before it takes
|
||||
/// its name, the render itself never touched; on the desktop a server-only render is downloaded into it; stored as 24.
|
||||
/// </summary>
|
||||
VideoCopy = 24,
|
||||
}
|
||||
|
||||
/// <summary>Why a photo left a sequence (its tombstone, owner review 2, R6); stored as a number.</summary>
|
||||
|
||||
@@ -278,6 +278,116 @@ public sealed record ExportSettings
|
||||
/// </summary>
|
||||
public bool SyncToServer { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// How the rendered frames play (owner review 1, R8): direction, loops, fades and a hold at the end, applied by
|
||||
/// <c>OutputProgram</c> between the plan and the encoder. Null at the default (forward, once, no fades, no hold), which
|
||||
/// <see cref="ProjectSettings.ToJson"/> writes whenever <see cref="PlaybackSettings.IsDefault"/>. Settings format 3. It
|
||||
/// lives in the export, so the batch presets of the export inherit it.
|
||||
/// </summary>
|
||||
public PlaybackSettings? Playback { get; init; }
|
||||
|
||||
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement>? Extra { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>The directions of <see cref="PlaybackSettings.Direction"/>: texts, not an enum, so a newer Chronos can add one.</summary>
|
||||
public static class PlaybackDirection
|
||||
{
|
||||
/// <summary>The plan as it is (the default, never written).</summary>
|
||||
public const string Forward = "forward";
|
||||
|
||||
/// <summary>The plan from its last frame to its first.</summary>
|
||||
public const string Reverse = "reverse";
|
||||
|
||||
/// <summary>Forward, then backward without repeating the turning frame.</summary>
|
||||
public const string Boomerang = "boomerang";
|
||||
|
||||
/// <summary>The directions this Chronos renders, in the order the editor offers them.</summary>
|
||||
public static IReadOnlyList<string> All { get; } = [Forward, Reverse, Boomerang];
|
||||
|
||||
/// <summary>Whether this Chronos renders <paramref name="direction"/> (null is forward); the comparison ignores case.</summary>
|
||||
public static bool IsKnown(string? direction) =>
|
||||
direction is null || All.Contains(direction, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The playback of an export (owner review 1, R8; settings format 3): each member null at its default and omitted then, so
|
||||
/// a project that sets nothing here keeps its text. Values out of range are clamped when rendered
|
||||
/// (<see cref="EffectiveLoops"/> and the other effective values); a direction this Chronos does not know renders forward
|
||||
/// with the warning <c>Export.Render.DirectionUnknown</c>.
|
||||
/// </summary>
|
||||
public sealed record PlaybackSettings
|
||||
{
|
||||
/// <summary>The most passes a video plays (<see cref="Loops"/>).</summary>
|
||||
public const int MaxLoops = 10;
|
||||
|
||||
/// <summary>The longest fade in or out, in seconds.</summary>
|
||||
public const double MaxFadeSeconds = 30;
|
||||
|
||||
/// <summary>The longest hold of the last frame, in seconds.</summary>
|
||||
public const double MaxHoldSeconds = 60;
|
||||
|
||||
/// <summary><see cref="PlaybackDirection"/>: null for forward; "reverse" or "boomerang".</summary>
|
||||
public string? Direction { get; init; }
|
||||
|
||||
/// <summary>Passes of the whole video, 1..<see cref="MaxLoops"/>; null for 1.</summary>
|
||||
public int? Loops { get; init; }
|
||||
|
||||
/// <summary>Seconds of fade from black at the start, 0..<see cref="MaxFadeSeconds"/>; null for 0.</summary>
|
||||
public double? FadeIn { get; init; }
|
||||
|
||||
/// <summary>Seconds of fade to black at the end, 0..<see cref="MaxFadeSeconds"/>; null for 0.</summary>
|
||||
public double? FadeOut { get; init; }
|
||||
|
||||
/// <summary>Seconds the last frame stays on screen after the last pass, 0..<see cref="MaxHoldSeconds"/>; null for 0.</summary>
|
||||
public double? HoldEnd { get; init; }
|
||||
|
||||
/// <summary>The direction rendered: forward for null and for a direction this Chronos does not know.</summary>
|
||||
[JsonIgnore]
|
||||
public string EffectiveDirection => Direction is { } d && PlaybackDirection.IsKnown(d) ? d.ToLowerInvariant() : PlaybackDirection.Forward;
|
||||
|
||||
/// <summary>The passes rendered, clamped to 1..<see cref="MaxLoops"/>.</summary>
|
||||
[JsonIgnore]
|
||||
public int EffectiveLoops => Math.Clamp(Loops ?? 1, 1, MaxLoops);
|
||||
|
||||
/// <summary>The fade in rendered, in seconds, clamped (a value that is not finite counts as 0).</summary>
|
||||
[JsonIgnore]
|
||||
public double EffectiveFadeIn => Seconds(FadeIn, MaxFadeSeconds);
|
||||
|
||||
/// <summary>The fade out rendered, in seconds, clamped (a value that is not finite counts as 0).</summary>
|
||||
[JsonIgnore]
|
||||
public double EffectiveFadeOut => Seconds(FadeOut, MaxFadeSeconds);
|
||||
|
||||
/// <summary>The hold rendered, in seconds, clamped (a value that is not finite counts as 0).</summary>
|
||||
[JsonIgnore]
|
||||
public double EffectiveHoldEnd => Seconds(HoldEnd, MaxHoldSeconds);
|
||||
|
||||
/// <summary>
|
||||
/// The playback renders as the default (forward, once, no fades, no hold) and holds nothing a newer Chronos wrote: the
|
||||
/// export then writes no playback at all. A direction this Chronos does not know is not the default (it is a newer
|
||||
/// Chronos's), so it is kept and raises the format.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool IsDefault =>
|
||||
(Direction is null || string.Equals(Direction, PlaybackDirection.Forward, StringComparison.OrdinalIgnoreCase))
|
||||
&& EffectiveLoops == 1 && EffectiveFadeIn == 0 && EffectiveFadeOut == 0 && EffectiveHoldEnd == 0 && Extra is not { Count: > 0 };
|
||||
|
||||
/// <summary>
|
||||
/// The same playback with each member at its default (forward, 1, 0) set to null, so it is not written; values out of
|
||||
/// range and unknown directions stay as they are. <see cref="ProjectSettings.ToJson"/> writes the playback this way.
|
||||
/// </summary>
|
||||
public PlaybackSettings Normalized() => this with
|
||||
{
|
||||
Direction = string.Equals(Direction, PlaybackDirection.Forward, StringComparison.OrdinalIgnoreCase) ? null : Direction,
|
||||
Loops = Loops == 1 ? null : Loops,
|
||||
FadeIn = FadeIn == 0 ? null : FadeIn,
|
||||
FadeOut = FadeOut == 0 ? null : FadeOut,
|
||||
HoldEnd = HoldEnd == 0 ? null : HoldEnd,
|
||||
};
|
||||
|
||||
private static double Seconds(double? value, double max) => value is { } v && double.IsFinite(v) ? Math.Clamp(v, 0, max) : 0;
|
||||
|
||||
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement>? Extra { get; set; }
|
||||
@@ -323,7 +433,10 @@ public sealed record LookSettings
|
||||
public sealed record ProjectSettings
|
||||
{
|
||||
/// <summary>The highest settings format this Chronos reads; a project of a higher one opens read-only (<see cref="IsNewerFormat"/>).</summary>
|
||||
public const int CurrentVersion = 2;
|
||||
public const int CurrentVersion = 3;
|
||||
|
||||
/// <summary>The format of a project whose export plays other than forward once without fades (<see cref="ExportSettings.Playback"/>).</summary>
|
||||
public const int PlaybackVersion = 3;
|
||||
|
||||
/// <summary>The format of a project that uses nothing added since the first one, which most projects are written as.</summary>
|
||||
public const int BaseVersion = 1;
|
||||
@@ -377,11 +490,13 @@ public sealed record ProjectSettings
|
||||
public bool IsNewerFormat => Version > CurrentVersion;
|
||||
|
||||
/// <summary>
|
||||
/// The lowest settings format that renders these settings the same: 2 while a turn, mirror, flip or straighten
|
||||
/// The lowest settings format that renders these settings the same: 3 while the export's playback is not the default
|
||||
/// (<see cref="PlaybackSettings.IsDefault"/>), 2 while a turn, mirror, flip or straighten
|
||||
/// (<see cref="CameraSettings.IsOriented"/>) or a look other than the identity is set, otherwise <see cref="BaseVersion"/>.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public int RequiredFormat => Camera.IsOriented || Look is { IsIdentity: false } ? 2 : BaseVersion;
|
||||
public int RequiredFormat =>
|
||||
Export.Playback is { IsDefault: false } ? PlaybackVersion : Camera.IsOriented || Look is { IsIdentity: false } ? 2 : BaseVersion;
|
||||
|
||||
/// <summary>The format <see cref="ToJson"/> writes: <see cref="RequiredFormat"/>, or a newer format read, kept as it is.</summary>
|
||||
[JsonIgnore]
|
||||
@@ -389,9 +504,16 @@ public sealed record ProjectSettings
|
||||
|
||||
/// <summary>
|
||||
/// The settings as JSON, stamped with <see cref="WrittenFormat"/>. Every serialisation of a project goes through here,
|
||||
/// so the version written always matches the members used.
|
||||
/// so the version written always matches the members used; a playback at its default is written as none, and each of
|
||||
/// its members at its default is left out (<see cref="PlaybackSettings.Normalized"/>).
|
||||
/// </summary>
|
||||
public string ToJson() => JsonSerializer.Serialize(Version == WrittenFormat ? this : this with { Version = WrittenFormat }, ProjectJson.Default.ProjectSettings);
|
||||
public string ToJson()
|
||||
{
|
||||
var written = Export.Playback is { } playback
|
||||
? this with { Export = Export with { Playback = playback.IsDefault ? null : playback.Normalized() } }
|
||||
: this;
|
||||
return JsonSerializer.Serialize(written.Version == WrittenFormat ? written : written with { Version = WrittenFormat }, ProjectJson.Default.ProjectSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a project; members missing from <paramref name="json"/> (an API client's partial settings, an older file)
|
||||
@@ -821,4 +943,5 @@ public sealed record ProjectSettings
|
||||
UseStringEnumConverter = true,
|
||||
PropertyNameCaseInsensitive = true)]
|
||||
[JsonSerializable(typeof(ProjectSettings))]
|
||||
[JsonSerializable(typeof(PlaybackSettings))]
|
||||
internal sealed partial class ProjectJson : JsonSerializerContext;
|
||||
@@ -0,0 +1,81 @@
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Video;
|
||||
|
||||
namespace Chronos.Core.Render;
|
||||
|
||||
/// <summary>One frame the encoder receives, in emission order (<see cref="OutputProgram"/>).</summary>
|
||||
/// <param name="PlanIndex">The frame of <see cref="RenderPlan.Frames"/> rendered for it.</param>
|
||||
/// <param name="Duration90k">How long it shows, on the 90 kHz clock: the planned frame's duration, a share of it (a held
|
||||
/// frame split per slot inside a fade), or longer (the hold at the end).</param>
|
||||
/// <param name="Gain">The linear-light multiplier of the fade to and from black, applied after the look and the knee
|
||||
/// (<c>FrameFinish</c>): 1 leaves the frame as it is, 0 is black. Already in linear light (the sRGB ramp converted), so a
|
||||
/// fade looks even.</param>
|
||||
public readonly record struct ProgramEntry(int PlanIndex, long Duration90k, double Gain);
|
||||
|
||||
/// <summary>
|
||||
/// The output program of a render (owner review 1, R8): the plan's frames in the order and for the time they are emitted,
|
||||
/// with the fade gain of each, from the export's <see cref="PlaybackSettings"/>. Reverse is the plan backwards; a boomerang
|
||||
/// is forward then backward without repeating the turning frame; loops repeat the pass (a boomerang's later passes start at
|
||||
/// its second frame, so the joint is not doubled); the hold extends the last emitted frame; fades longer than half of the
|
||||
/// program are scaled to fit (warning <see cref="FadesShortenedWarning"/>). Every pass is rendered again, so the render
|
||||
/// time grows with <see cref="Count"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Phase 5 groundwork: the API is final; <see cref="Build(IReadOnlyList{PlannedFrame}, PlaybackSettings?, Rational)"/> emits
|
||||
/// the plan forward once, without fades or hold, until the output program parcel completes it.
|
||||
/// </remarks>
|
||||
public sealed class OutputProgram
|
||||
{
|
||||
/// <summary>Warning key: the fades were longer than half of the program and were scaled to fit.</summary>
|
||||
public const string FadesShortenedWarning = "Export.Render.FadesShortened";
|
||||
|
||||
/// <summary>Warning key: the playback names a direction this Chronos does not know ({0}); the video plays forward.</summary>
|
||||
public const string DirectionUnknownWarning = "Export.Render.DirectionUnknown";
|
||||
|
||||
/// <summary>Warning key: a boomerang is not rendered with star trails; the video plays forward.</summary>
|
||||
public const string BoomerangStackWarning = "Export.Render.BoomerangStack";
|
||||
|
||||
private OutputProgram(IReadOnlyList<ProgramEntry> entries, IReadOnlyList<RenderWarning> warnings)
|
||||
{
|
||||
Entries = entries;
|
||||
Warnings = warnings;
|
||||
long total = 0;
|
||||
foreach (var entry in entries) total += entry.Duration90k;
|
||||
Duration90k = total;
|
||||
}
|
||||
|
||||
/// <summary>The emitted frames, in order.</summary>
|
||||
public IReadOnlyList<ProgramEntry> Entries { get; }
|
||||
|
||||
/// <summary>Frames the encoder receives (and the render renders).</summary>
|
||||
public int Count => Entries.Count;
|
||||
|
||||
/// <summary>Exact total duration on the 90 kHz clock, holds included.</summary>
|
||||
public long Duration90k { get; }
|
||||
|
||||
/// <summary>The duration in seconds.</summary>
|
||||
public double DurationSeconds => Duration90k / 90000.0;
|
||||
|
||||
/// <summary>What the program changed of the playback asked for (fades shortened, an unknown direction played forward).</summary>
|
||||
public IReadOnlyList<RenderWarning> Warnings { get; }
|
||||
|
||||
/// <summary>The program of <paramref name="plan"/>'s frames played as <paramref name="playback"/> says (null: forward once).</summary>
|
||||
public static OutputProgram Build(RenderPlan plan, PlaybackSettings? playback, Rational frameRate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(plan);
|
||||
return Build(plan.Frames, playback, frameRate);
|
||||
}
|
||||
|
||||
/// <summary>The program of the planned <paramref name="frames"/> played as <paramref name="playback"/> says (null: forward once).</summary>
|
||||
/// <param name="frameRate">The output frame rate: the grid a held frame is split on inside a fade.</param>
|
||||
public static OutputProgram Build(IReadOnlyList<PlannedFrame> frames, PlaybackSettings? playback, Rational frameRate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(frames);
|
||||
if (frameRate.Numerator <= 0 || frameRate.Denominator <= 0) throw new ArgumentOutOfRangeException(nameof(frameRate));
|
||||
var warnings = new List<RenderWarning>();
|
||||
if (playback?.Direction is { } direction && !PlaybackDirection.IsKnown(direction)) warnings.Add(new RenderWarning(DirectionUnknownWarning, direction));
|
||||
var entries = new ProgramEntry[frames.Count];
|
||||
for (var i = 0; i < frames.Count; i++) entries[i] = new ProgramEntry(i, frames[i].Duration90k, 1);
|
||||
return new OutputProgram(entries, warnings);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Chronos.Core.Export;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Video;
|
||||
|
||||
namespace Chronos.Core.Render;
|
||||
|
||||
@@ -9,6 +10,25 @@ namespace Chronos.Core.Render;
|
||||
/// </summary>
|
||||
public static class RenderRules
|
||||
{
|
||||
/// <summary>
|
||||
/// The settings format a still job needs (owner review 1, R8, "Save frame"): an older program reads the job as a render
|
||||
/// of the whole video, so it must never claim one.
|
||||
/// </summary>
|
||||
public const int StillFormat = 3;
|
||||
|
||||
/// <summary>The codecs a still frame is saved with, in the order "Save frame" offers them: PNG, JPEG and TIFF 16-bit.</summary>
|
||||
public static IReadOnlyList<VideoCodec> StillCodecs { get; } = [VideoCodec.PngSequence, VideoCodec.JpegSequence, VideoCodec.Tiff16Sequence];
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="RequiredFormat(ProjectSettings, ResolvedExport, int, int)"/>, and at least <see cref="StillFormat"/> for a
|
||||
/// still job (<paramref name="still"/>: one frame saved as an image).
|
||||
/// </summary>
|
||||
public static int RequiredFormat(ProjectSettings settings, ResolvedExport export, int sourceWidth, int sourceHeight, bool still)
|
||||
{
|
||||
var format = RequiredFormat(settings, export, sourceWidth, sourceHeight);
|
||||
return still ? int.Max(format, StillFormat) : format;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The settings format a render of <paramref name="settings"/> with <paramref name="export"/> on a source of the given
|
||||
/// (Exif-oriented) size needs: the format the settings are written in (<see cref="ProjectSettings.WrittenFormat"/>), and
|
||||
|
||||
@@ -68,6 +68,12 @@ public sealed class ArchiveService : IJobHandlerProvider
|
||||
/// <summary>Deletes photos of a sequence into the archive's trash and restores them (owner review 2, R6).</summary>
|
||||
public FrameTrash FrameTrash { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The videos library of this index (owner review 1, R9): every render listed, deleted into the trash, restored and copied
|
||||
/// into a videos folder. The groundwork stub until the library lands (<see cref="Chronos.Data.Videos.IVideoLibrary.IsAvailable"/> false).
|
||||
/// </summary>
|
||||
public Chronos.Data.Videos.IVideoLibrary Videos { get; } = Chronos.Data.Videos.NotImplementedVideoLibrary.Instance;
|
||||
|
||||
/// <summary>Converts sequences to JPEG, TIFF-16 or linear DNG, replacing their frames or into new sequences (owner review 2, R7).</summary>
|
||||
public MassConverter Converter { get; }
|
||||
|
||||
|
||||
@@ -60,6 +60,12 @@ public enum TrashKind
|
||||
|
||||
/// <summary>Originals a conversion replaced (owner review 2, R7): erased only while their replacements still match.</summary>
|
||||
Replaced,
|
||||
|
||||
/// <summary>
|
||||
/// A render deleted from the videos library (owner review 1, R9): its file under <c>trash/videos/</c> with a record, listed
|
||||
/// as "videos" (<see cref="Videos.VideoTrashNames"/>).
|
||||
/// </summary>
|
||||
Videos,
|
||||
}
|
||||
|
||||
/// <summary>An entry of an archive's trash, as <see cref="SequenceTrash.ListAsync"/> lists it: a deleted sequence or deleted photos.</summary>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
-- The videos library (owner review 1, R9). Renders remember the SHA-256 of their file (null for an image sequence's
|
||||
-- folder, verified file by file when copied, and for renders recorded before this migration, hashed the first time they
|
||||
-- are copied, deleted or restored) and their kind (null for a video or an image sequence, told apart by the codec;
|
||||
-- 'still' for one frame saved as an image). The library lists every render newest first. render_copies records each
|
||||
-- hash-verified copy into a videos folder; it has no foreign key to renders, so the copy of a server render downloaded to
|
||||
-- a PC is recorded too, and a copy outlives its render. No backfill. Mirrors sqlite/0010_videos.sql.
|
||||
|
||||
ALTER TABLE renders ADD COLUMN sha256 text;
|
||||
ALTER TABLE renders ADD COLUMN kind text;
|
||||
CREATE INDEX ix_renders_created ON renders (created);
|
||||
|
||||
CREATE TABLE render_copies (
|
||||
id uuid NOT NULL PRIMARY KEY,
|
||||
render_id uuid NOT NULL,
|
||||
path text NOT NULL,
|
||||
sha256 text,
|
||||
bytes bigint NOT NULL DEFAULT 0,
|
||||
copied_at timestamptz NOT NULL,
|
||||
copied_by text
|
||||
);
|
||||
CREATE INDEX ix_render_copies_render ON render_copies (render_id);
|
||||
@@ -0,0 +1,21 @@
|
||||
-- The videos library (owner review 1, R9). Renders remember the SHA-256 of their file (null for an image sequence's
|
||||
-- folder, verified file by file when copied, and for renders recorded before this migration, hashed the first time they
|
||||
-- are copied, deleted or restored) and their kind (null for a video or an image sequence, told apart by the codec;
|
||||
-- 'still' for one frame saved as an image). The library lists every render newest first. render_copies records each
|
||||
-- hash-verified copy into a videos folder; it has no foreign key to renders, so the copy of a server render downloaded to
|
||||
-- a PC is recorded too, and a copy outlives its render. No backfill. Mirrors postgres/0010_videos.sql.
|
||||
|
||||
ALTER TABLE renders ADD COLUMN sha256 TEXT;
|
||||
ALTER TABLE renders ADD COLUMN kind TEXT;
|
||||
CREATE INDEX ix_renders_created ON renders (created);
|
||||
|
||||
CREATE TABLE render_copies (
|
||||
id TEXT NOT NULL PRIMARY KEY,
|
||||
render_id TEXT NOT NULL,
|
||||
path TEXT NOT NULL,
|
||||
sha256 TEXT,
|
||||
bytes INTEGER NOT NULL DEFAULT 0,
|
||||
copied_at TEXT NOT NULL,
|
||||
copied_by TEXT
|
||||
);
|
||||
CREATE INDEX ix_render_copies_render ON render_copies (render_id);
|
||||
@@ -44,6 +44,34 @@ public static class ProcessingJobs
|
||||
JsonSerializer.Serialize(parameters, ProtocolJson.Default.RenderJobParameters), JobPriority.User);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="JobKind.Render"/> of one frame saved as an image (owner review 1, R8, "Save frame"): frame
|
||||
/// <paramref name="frameIndex"/> of the sequence (its photo <paramref name="photoSha256"/> wins when both are given and the
|
||||
/// frames moved since) with <paramref name="codec"/>, one of <see cref="RenderRules.StillCodecs"/>, at the output size of
|
||||
/// <paramref name="export"/>, with every correction and no playback. <paramref name="project"/> embeds the settings to
|
||||
/// render, as <see cref="Render"/>. The job needs settings format <see cref="RenderRules.StillFormat"/>, so an older node,
|
||||
/// which would render the whole video, never claims it.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="codec"/> is not a still codec, or <paramref name="frameIndex"/> is negative.</exception>
|
||||
public static ArchiveJobRequest Still(Sequence sequence, ExportSettings export, VideoCodec codec, int frameIndex, string? photoSha256, int sourceWidth,
|
||||
int sourceHeight, ProjectSettings? project = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sequence);
|
||||
ArgumentNullException.ThrowIfNull(export);
|
||||
if (!RenderRules.StillCodecs.Contains(codec)) throw new ArgumentOutOfRangeException(nameof(codec), codec, "Not a still codec.");
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(frameIndex);
|
||||
var still = export with { Batch = [], Playback = null, Overrides = export.Overrides with { Codec = CodecName(codec), Container = null } };
|
||||
var parameters = Parameters(still, sourceWidth, sourceHeight, project?.ToJson(), false, project ?? ReadSettings(sequence.SettingsJson));
|
||||
parameters = parameters with
|
||||
{
|
||||
StillFrame = frameIndex,
|
||||
StillPhoto = string.IsNullOrEmpty(photoSha256) ? null : photoSha256.ToLowerInvariant(),
|
||||
RequiredSettingsFormat = int.Max(parameters.RequiredSettingsFormat, RenderRules.StillFormat),
|
||||
};
|
||||
return new ArchiveJobRequest(JobKind.Render, [sequence.Id], RenderLabel(sequence.DisplayTitle, parameters.PresetName),
|
||||
JsonSerializer.Serialize(parameters, ProtocolJson.Default.RenderJobParameters), JobPriority.User);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="JobKind.Render"/> of a project version (owner review 2, R8) on the sequence's home: the version's portable
|
||||
/// settings, placed on the sequence's frames by the render, with <paramref name="export"/> as their export section; the
|
||||
|
||||
@@ -0,0 +1,289 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Archiving.Jobs;
|
||||
using Chronos.Protocol;
|
||||
|
||||
namespace Chronos.Data.Videos;
|
||||
|
||||
/// <summary>
|
||||
/// What the videos library lists (owner review 1, R9): every member optional, combined with "and". The values are those of
|
||||
/// <c>GET /api/v1/videos</c> (<see cref="VideoQueryDto"/>).
|
||||
/// </summary>
|
||||
public sealed record VideoQuery
|
||||
{
|
||||
/// <summary>The most videos a page holds.</summary>
|
||||
public const int MaxLimit = 500;
|
||||
|
||||
/// <summary>Text in the sequence title, the preset name or the file name (any case).</summary>
|
||||
public string? Text { get; init; }
|
||||
|
||||
/// <summary><see cref="RenderKind.Video"/>, <see cref="RenderKind.Still"/> or <see cref="RenderKind.Sequence"/>; null for every kind.</summary>
|
||||
public string? Kind { get; init; }
|
||||
|
||||
/// <summary>A codec name as recorded (<c>h264</c>, <c>hevc</c>, <c>pngsequence</c>…); null for every codec.</summary>
|
||||
public string? Codec { get; init; }
|
||||
|
||||
/// <summary>The year the render was made (UTC).</summary>
|
||||
public int? Year { get; init; }
|
||||
|
||||
/// <summary>The renders of one sequence.</summary>
|
||||
public Guid? SequenceId { get; init; }
|
||||
|
||||
/// <summary>One of <see cref="VideoSorts"/>; null for newest first.</summary>
|
||||
public string? Sort { get; init; }
|
||||
|
||||
/// <summary>The <see cref="VideoPage.Next"/> of the previous page; null for the first.</summary>
|
||||
public string? Cursor { get; init; }
|
||||
|
||||
/// <summary>Videos per page, 1..<see cref="MaxLimit"/>.</summary>
|
||||
public int Limit { get; init; } = 100;
|
||||
|
||||
/// <summary>The query of an API request (its limit clamped, the default when none is given).</summary>
|
||||
public static VideoQuery From(VideoQueryDto dto)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(dto);
|
||||
return new VideoQuery
|
||||
{
|
||||
Text = dto.Q,
|
||||
Kind = dto.Kind,
|
||||
Codec = dto.Codec,
|
||||
Year = dto.Year,
|
||||
SequenceId = dto.Sequence,
|
||||
Sort = dto.Sort,
|
||||
Cursor = dto.Cursor,
|
||||
Limit = dto.Limit is { } limit ? Math.Clamp(limit, 1, MaxLimit) : 100,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A render as the videos library shows it: the render, its sequence and project, where its file is, and its copies.</summary>
|
||||
public sealed record VideoItem
|
||||
{
|
||||
public required Render Render { get; init; }
|
||||
|
||||
/// <summary>The display title of the render's sequence.</summary>
|
||||
public required string SequenceTitle { get; init; }
|
||||
|
||||
/// <summary>When the sequence's first photo was taken; null when unknown.</summary>
|
||||
public DateTime? SequenceFirstCapture { get; init; }
|
||||
|
||||
/// <summary>The project rendered (owner review 2, R8); null for a render of the sequence's settings.</summary>
|
||||
public string? ProjectName { get; init; }
|
||||
|
||||
/// <summary>The number of the project version rendered; null with <see cref="ProjectName"/>.</summary>
|
||||
public int? ProjectVersionNumber { get; init; }
|
||||
|
||||
/// <summary>Absolute path of the render's file (or folder, for an image sequence) on this host.</summary>
|
||||
public required string FullPath { get; init; }
|
||||
|
||||
/// <summary>The file is not at <see cref="FullPath"/>: shown as Missing, and a delete removes only its row.</summary>
|
||||
public bool Missing { get; init; }
|
||||
|
||||
/// <summary>Its verified copies in videos folders, oldest first.</summary>
|
||||
public IReadOnlyList<RenderCopy> Copies { get; init; } = [];
|
||||
|
||||
/// <summary>The library kind (<see cref="RenderKind.Of(Render)"/>).</summary>
|
||||
public string Kind => RenderKind.Of(Render);
|
||||
|
||||
/// <summary><see cref="VideoStates.Ok"/> or <see cref="VideoStates.Missing"/>.</summary>
|
||||
public string State => Missing ? VideoStates.Missing : VideoStates.Ok;
|
||||
|
||||
/// <summary>The file (or folder) name.</summary>
|
||||
public string FileName => Path.GetFileName(FullPath.TrimEnd('/', '\\'));
|
||||
}
|
||||
|
||||
/// <summary>One page of the videos library; <see cref="Next"/> is the cursor of the next page, null on the last one.</summary>
|
||||
/// <param name="Total">Videos matching the query on every page; null when not counted.</param>
|
||||
public sealed record VideoPage(IReadOnlyList<VideoItem> Items, string? Next, long? Total = null)
|
||||
{
|
||||
public static VideoPage Empty { get; } = new([], null, 0);
|
||||
}
|
||||
|
||||
/// <summary>A render a delete leaves where it is: <see cref="Reason"/> is one of <see cref="VideoBlockReasons"/>.</summary>
|
||||
/// <param name="Video">The render, when it exists.</param>
|
||||
public sealed record VideoBlocked(Guid RenderId, string Reason, VideoItem? Video = null);
|
||||
|
||||
/// <summary>
|
||||
/// The dry run of deleting renders into the trash (decision 17): the renders that go (a missing one only loses its row), the
|
||||
/// renders left where they are, and the plan's fingerprint, which the delete itself must give back. Copies in videos
|
||||
/// folders are never touched.
|
||||
/// </summary>
|
||||
public sealed record VideoDeletePlan(IReadOnlyList<VideoItem> Items, IReadOnlyList<VideoBlocked> Blocked, string Fingerprint)
|
||||
{
|
||||
/// <summary>The bytes that move into the trash (missing files count nothing).</summary>
|
||||
public long Bytes => Items.Where(i => !i.Missing).Sum(i => i.Render.Bytes);
|
||||
}
|
||||
|
||||
/// <summary>What a delete did: the renders moved into the trash (or, missing, whose rows went), those left, and the trash entries made.</summary>
|
||||
/// <param name="TrashEntries">The names of the entries made (<see cref="VideoTrashNames"/>), each restorable.</param>
|
||||
public sealed record VideoDeleteResult(IReadOnlyList<VideoItem> Deleted, IReadOnlyList<VideoBlocked> Blocked, IReadOnlyList<string> TrashEntries);
|
||||
|
||||
/// <summary>
|
||||
/// The parameters of a <see cref="JobKind.VideoCopy"/> job (decision 16): the renders to copy into <see cref="Folder"/>,
|
||||
/// each hash-verified before it takes its name (a free one, " (2)" on a collision), the render never touched.
|
||||
/// </summary>
|
||||
/// <param name="RenderIds">The renders, in the order they are copied.</param>
|
||||
/// <param name="Folder">The videos folder (absolute), checked again when the job runs.</param>
|
||||
/// <param name="FromServer">On the desktop: the renders are the signed-in server's, downloaded into the folder.</param>
|
||||
/// <param name="RequestedBy">The user (server) or PC (desktop) recorded as <see cref="RenderCopy.CopiedBy"/>.</param>
|
||||
public sealed record VideoCopyParameters(IReadOnlyList<Guid> RenderIds, string Folder, bool FromServer = false, string? RequestedBy = null)
|
||||
{
|
||||
public string ToJson() => JsonSerializer.Serialize(this, VideoJson.Default.VideoCopyParameters);
|
||||
|
||||
/// <summary>The parameters of a job; null when it has none that read.</summary>
|
||||
public static VideoCopyParameters? Read(string? json)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json)) return null;
|
||||
try
|
||||
{
|
||||
return JsonSerializer.Deserialize(json, VideoJson.Default.VideoCopyParameters) is { RenderIds: not null, Folder.Length: > 0 } parameters ? parameters : null;
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The error codes of the videos library (<see cref="VideoLibraryException.Code"/>), the same as the server's API errors:
|
||||
/// each has a server message <c>Server.Error.<Code></c> and a desktop message <c>Errors.Videos.*</c>.
|
||||
/// </summary>
|
||||
public static class VideoErrors
|
||||
{
|
||||
/// <summary>No videos folder is set (409).</summary>
|
||||
public const string FolderUnset = "videos_folder_unset";
|
||||
|
||||
/// <summary>The videos folder lies inside an archive root or the workspace (422).</summary>
|
||||
public const string FolderInvalid = "videos_folder_invalid";
|
||||
|
||||
/// <summary>The plan of a delete changed since it was made (409; nothing moved).</summary>
|
||||
public const string PlanChanged = "plan_changed";
|
||||
|
||||
/// <summary>A copy, or a trashed video being restored, does not match its render's SHA-256.</summary>
|
||||
public const string HashMismatch = "trash_hash_mismatch";
|
||||
|
||||
/// <summary>Not enough free space in the videos folder (507).</summary>
|
||||
public const string NoSpace = "videos_no_space";
|
||||
|
||||
/// <summary>A trashed video's sequence is not in the library: restore the sequence first (409).</summary>
|
||||
public const string SequenceGone = "sequence_gone";
|
||||
|
||||
/// <summary>A send, an upload or a copy of the render is running (409).</summary>
|
||||
public const string Busy = "video_busy";
|
||||
}
|
||||
|
||||
/// <summary>A videos library operation refused with one of <see cref="VideoErrors"/>; nothing was changed.</summary>
|
||||
public sealed class VideoLibraryException(string code, string message) : InvalidOperationException(message)
|
||||
{
|
||||
public string Code { get; } = code;
|
||||
}
|
||||
|
||||
/// <summary>The names of the videos trash entries (decision 17): <c>videos-<render id>-<UTC ticks></c>, listed as kind "videos".</summary>
|
||||
public static class VideoTrashNames
|
||||
{
|
||||
/// <summary>The prefix of every videos entry name.</summary>
|
||||
public const string Prefix = "videos-";
|
||||
|
||||
/// <summary>The folder of the videos area inside an archive's trash, which holds the entries and their records.</summary>
|
||||
public const string FolderName = "videos";
|
||||
|
||||
/// <summary>The entry name of render <paramref name="renderId"/> deleted at <paramref name="deletedAt"/>.</summary>
|
||||
public static string EntryName(Guid renderId, DateTimeOffset deletedAt) =>
|
||||
Prefix + renderId.ToString("D") + "-" + deletedAt.UtcTicks.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>Whether <paramref name="name"/> is a videos entry name (and nothing else: no path, no other entry's name).</summary>
|
||||
public static bool IsEntryName(string? name) => TryParse(name, out _, out _);
|
||||
|
||||
/// <summary>The render id and the UTC ticks of a videos entry name; false for any other name.</summary>
|
||||
public static bool TryParse(string? name, out Guid renderId, out long ticks)
|
||||
{
|
||||
renderId = Guid.Empty;
|
||||
ticks = 0;
|
||||
if (name is null || !name.StartsWith(Prefix, StringComparison.Ordinal)) return false;
|
||||
var rest = name.AsSpan(Prefix.Length);
|
||||
// A "D" guid is 36 characters; then "-" and the ticks.
|
||||
return rest.Length > 37 && rest[36] == '-' && Guid.TryParseExact(rest[..36], "D", out renderId)
|
||||
&& long.TryParse(rest[37..], System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, out ticks);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The videos library of one index (owner review 1, R9): every render of its archives in one list, deleted into the trash
|
||||
/// and restored by id, and copied hash-verified into a videos folder. The desktop's Videos section and the server's
|
||||
/// <c>/api/v1/videos</c> endpoints use it; <see cref="Archiving.ArchiveService.Videos"/> is the instance of an archive engine.
|
||||
/// </summary>
|
||||
public interface IVideoLibrary
|
||||
{
|
||||
/// <summary>False for the groundwork stub (<see cref="NotImplementedVideoLibrary"/>): callers show no library then.</summary>
|
||||
bool IsAvailable { get; }
|
||||
|
||||
/// <summary>One page of the renders matching <paramref name="query"/>, each with its copies and whether its file is there.</summary>
|
||||
Task<VideoPage> ListAsync(VideoQuery query, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>One render; null when the index has no such render.</summary>
|
||||
Task<VideoItem?> GetAsync(Guid renderId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>The dry run of deleting <paramref name="renderIds"/> into the trash; nothing moves.</summary>
|
||||
Task<VideoDeletePlan> PlanDeleteAsync(IReadOnlyList<Guid> renderIds, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes <paramref name="renderIds"/> as planned: each file into <c>.chronos/trash/videos/</c> of its archive with a
|
||||
/// record, its row removed and its sequence's render count recounted; a missing file loses only its row.
|
||||
/// </summary>
|
||||
/// <exception cref="VideoLibraryException"><see cref="VideoErrors.PlanChanged"/>: <paramref name="fingerprint"/> is not the plan's now; nothing moved.</exception>
|
||||
Task<VideoDeleteResult> DeleteAsync(IReadOnlyList<Guid> renderIds, string fingerprint, string? deletedBy, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Brings a videos trash entry of archive <paramref name="archiveId"/> back: the file re-hashed against its record, moved
|
||||
/// back (to a free name when its own is taken) and its row inserted again with the same render id.
|
||||
/// </summary>
|
||||
/// <exception cref="DirectoryNotFoundException">The entry is not in the trash.</exception>
|
||||
/// <exception cref="VideoLibraryException"><see cref="VideoErrors.HashMismatch"/> or <see cref="VideoErrors.SequenceGone"/>; nothing moved.</exception>
|
||||
Task<Render> RestoreAsync(Guid archiveId, string entryName, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Why <paramref name="folder"/> cannot be the videos folder (<see cref="VideoErrors.FolderUnset"/> or
|
||||
/// <see cref="VideoErrors.FolderInvalid"/>); null when it can.
|
||||
/// </summary>
|
||||
string? FolderProblem(string? folder);
|
||||
|
||||
/// <summary>The <see cref="JobKind.VideoCopy"/> job copying <paramref name="parameters"/>' renders; enqueue it on the host's engine.</summary>
|
||||
/// <exception cref="VideoLibraryException">The folder cannot be the videos folder (<see cref="FolderProblem"/>).</exception>
|
||||
ArchiveJobRequest CopyJob(VideoCopyParameters parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The videos library until its parcel lands (phase 5 groundwork): lists nothing, finds nothing, and refuses every change
|
||||
/// with <see cref="NotImplementedException"/>; registered so the server and the desktop compile against
|
||||
/// <see cref="IVideoLibrary"/>.
|
||||
/// </summary>
|
||||
public sealed class NotImplementedVideoLibrary : IVideoLibrary
|
||||
{
|
||||
public static NotImplementedVideoLibrary Instance { get; } = new();
|
||||
|
||||
public bool IsAvailable => false;
|
||||
|
||||
public Task<VideoPage> ListAsync(VideoQuery query, CancellationToken cancellationToken = default) => Task.FromResult(VideoPage.Empty);
|
||||
|
||||
public Task<VideoItem?> GetAsync(Guid renderId, CancellationToken cancellationToken = default) => Task.FromResult<VideoItem?>(null);
|
||||
|
||||
public Task<VideoDeletePlan> PlanDeleteAsync(IReadOnlyList<Guid> renderIds, CancellationToken cancellationToken = default) =>
|
||||
throw new NotImplementedException("The videos library is not implemented yet.");
|
||||
|
||||
public Task<VideoDeleteResult> DeleteAsync(IReadOnlyList<Guid> renderIds, string fingerprint, string? deletedBy, CancellationToken cancellationToken = default) =>
|
||||
throw new NotImplementedException("The videos library is not implemented yet.");
|
||||
|
||||
public Task<Render> RestoreAsync(Guid archiveId, string entryName, CancellationToken cancellationToken = default) =>
|
||||
throw new NotImplementedException("The videos library is not implemented yet.");
|
||||
|
||||
public string? FolderProblem(string? folder) => string.IsNullOrWhiteSpace(folder) ? VideoErrors.FolderUnset : null;
|
||||
|
||||
public ArchiveJobRequest CopyJob(VideoCopyParameters parameters) => throw new NotImplementedException("The videos library is not implemented yet.");
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
PropertyNameCaseInsensitive = true)]
|
||||
[JsonSerializable(typeof(VideoCopyParameters))]
|
||||
internal sealed partial class VideoJson : JsonSerializerContext;
|
||||
@@ -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) =>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
@@ -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><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);
|
||||
@@ -29,4 +29,10 @@ export const icons = {
|
||||
hero: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 4.8 L8.9 6.9 L11.1 7.1 L9.4 8.5 L9.9 10.7 L8 9.5 L6.1 10.7 L6.6 8.5 L4.9 7.1 L7.1 6.9 Z" fill="currentColor"/><path d="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
image: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M9.600000000000001 5.6 A1.2 1.2 0 1 0 12.0 5.6 A1.2 1.2 0 1 0 9.600000000000001 5.6 Z" fill="currentColor"/><path d="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 11 L5.5 7 L9 10.5 L11 8.5 L14.5 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
warning: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 1.8 L14.8 13.8 H1.2 Z M8 6.2 V9.6 M8 11.7 V11.8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
videos: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M5.5 6.5 L9.5 9 L5.5 11.5 Z" fill="currentColor"/><path d="M3.0 4 H11.0 A1.5 1.5 0 0 1 12.5 5.5 V12.5 A1.5 1.5 0 0 1 11.0 14 H3.0 A1.5 1.5 0 0 1 1.5 12.5 V5.5 A1.5 1.5 0 0 1 3.0 4 Z M4.5 1.5 H13 A1.5 1.5 0 0 1 14.5 3 V11.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
play: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M4.5 2.8 L13 8 L4.5 13.2 Z" fill="currentColor"/></svg>`,
|
||||
copyToFolder: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M1.5 4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H13.5 A1 1 0 0 1 14.5 5.5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z M8 6.5 V11 M6 9 L8 11 L10 9" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
stillFrame: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M6.5 5.5 H9.5 A0.5 0.5 0 0 1 10 6.0 V10.0 A0.5 0.5 0 0 1 9.5 10.5 H6.5 A0.5 0.5 0 0 1 6 10.0 V6.0 A0.5 0.5 0 0 1 6.5 5.5 Z" fill="currentColor"/><path d="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M4.5 2.5 V13.5 M11.5 2.5 V13.5 M1.5 6 H4.5 M1.5 10 H4.5 M11.5 6 H14.5 M11.5 10 H14.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
fade: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M3 12 L13 4 V12 Z" fill="currentColor"/><path d="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
boomerang: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2 5 H11 A3 3 0 0 1 11 11 H3 M5 8.8 L2.8 11 L5 13.2" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
|
||||
};
|
||||
@@ -3,6 +3,7 @@ using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Housekeeping;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Data.Videos;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Server.Configuration;
|
||||
using Chronos.Server.Events;
|
||||
@@ -74,6 +75,8 @@ public static class ArchiveModule
|
||||
});
|
||||
services.AddSingleton<IArchiveIngest>(sp => sp.GetRequiredService<ArchiveService>().Ingest);
|
||||
services.AddSingleton<IJobHandlerProvider>(sp => sp.GetRequiredService<ArchiveService>());
|
||||
// The videos library of the archive's index (owner review 1, R9): /api/v1/videos.
|
||||
services.AddSingleton<IVideoLibrary>(sp => sp.GetRequiredService<ArchiveService>().Videos);
|
||||
services.AddSingleton<IFrameAssetLocator, ArchiveAssetLocator>();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
<ui:IconData x:Key="Icon.Analyse" Stroke="M1.5 8.5 H4.5 L6.5 3.5 L9.5 12.5 L11.5 8.5 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Archive" Stroke="M2 4.5 H14 V13.5 H2 Z M2 2 H14 V4.5 H2 Z M6 8 H10" />
|
||||
<ui:IconData x:Key="Icon.Back" Stroke="M13 8 H3 M7 4 L3 8 L7 12" IsDirectional="True" />
|
||||
<ui:IconData x:Key="Icon.Boomerang" Stroke="M2 5 H11 A3 3 0 0 1 11 11 H3 M5 8.8 L2.8 11 L5 13.2" />
|
||||
<ui:IconData x:Key="Icon.Calendar" Stroke="M3.0 3 H13.0 A1.5 1.5 0 0 1 14.5 4.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H3.0 A1.5 1.5 0 0 1 1.5 13.0 V4.5 A1.5 1.5 0 0 1 3.0 3 Z M1.5 6.5 H14.5 M5 1.5 V4 M11 1.5 V4" />
|
||||
<ui:IconData x:Key="Icon.Camera" Stroke="M1.5 5 A1 1 0 0 1 2.5 4 H4.5 L6 2.5 H10 L11.5 4 H13.5 A1 1 0 0 1 14.5 5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z M5.2 8.5 A2.8 2.8 0 1 0 10.8 8.5 A2.8 2.8 0 1 0 5.2 8.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Cancel" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5.8 5.8 L10.2 10.2 M10.2 5.8 L5.8 10.2" />
|
||||
@@ -22,6 +23,7 @@
|
||||
<ui:IconData x:Key="Icon.Close" Stroke="M4 4 L12 12 M12 4 L4 12" />
|
||||
<ui:IconData x:Key="Icon.Compare" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M8 1 V15" />
|
||||
<ui:IconData x:Key="Icon.Copy" Stroke="M6.5 5 H13.0 A1.5 1.5 0 0 1 14.5 6.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H6.5 A1.5 1.5 0 0 1 5 13.0 V6.5 A1.5 1.5 0 0 1 6.5 5 Z M11 5 V2.5 A1 1 0 0 0 10 1.5 H2.5 A1 1 0 0 0 1.5 2.5 V10 A1 1 0 0 0 2.5 11 H5" />
|
||||
<ui:IconData x:Key="Icon.CopyToFolder" Stroke="M1.5 4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H13.5 A1 1 0 0 1 14.5 5.5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z M8 6.5 V11 M6 9 L8 11 L10 9" />
|
||||
<ui:IconData x:Key="Icon.CropMask" Stroke="M4 1.5 V12 H14.5 M1.5 4 H12 V14.5" />
|
||||
<ui:IconData x:Key="Icon.Cross" Stroke="M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5" />
|
||||
<ui:IconData x:Key="Icon.Database" Stroke="M2.5 3.8 C2.5 2.5 13.5 2.5 13.5 3.8 C13.5 5.1 2.5 5.1 2.5 3.8 Z M2.5 3.8 V12.2 C2.5 13.5 13.5 13.5 13.5 12.2 V3.8 M2.5 8 C2.5 9.3 13.5 9.3 13.5 8" />
|
||||
@@ -37,6 +39,7 @@
|
||||
<ui:IconData x:Key="Icon.Exposure" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4 M4.5 6 H7 M5.75 4.75 V7.25 M9 10 H11.5" />
|
||||
<ui:IconData x:Key="Icon.ExternalLink" Stroke="M9.5 2 H14 V6.5 M14 2 L7.5 8.5 M12 9.5 V13 A1 1 0 0 1 11 14 H3 A1 1 0 0 1 2 13 V5 A1 1 0 0 1 3 4 H6.5" IsDirectional="True" />
|
||||
<ui:IconData x:Key="Icon.Eye" Stroke="M1.5 8 C3.5 4 12.5 4 14.5 8 C12.5 12 3.5 12 1.5 8 Z M5.8 8 A2.2 2.2 0 1 0 10.2 8 A2.2 2.2 0 1 0 5.8 8 Z" />
|
||||
<ui:IconData x:Key="Icon.Fade" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z" Fill="M3 12 L13 4 V12 Z" />
|
||||
<ui:IconData x:Key="Icon.Filmstrip" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M4.5 2.5 V13.5 M11.5 2.5 V13.5 M1.5 6 H4.5 M1.5 10 H4.5 M11.5 6 H14.5 M11.5 10 H14.5" />
|
||||
<ui:IconData x:Key="Icon.Filter" Stroke="M1.5 2.5 H14.5 L9.5 8.5 V13.5 L6.5 12 V8.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Flip" Stroke="M1.5 8 H3 M5.5 8 H7.5 M10 8 H12 M14 8 H14.5 M4 6 H12.5 V1.5 Z" Fill="M4 10 L12.5 14.5 V10 Z" />
|
||||
@@ -88,6 +91,7 @@
|
||||
<ui:IconData x:Key="Icon.Stack" Stroke="M8 1.8 L14.5 5.2 L8 8.6 L1.5 5.2 Z M1.5 8.2 L8 11.6 L14.5 8.2 M1.5 11 L8 14.4 L14.5 11" />
|
||||
<ui:IconData x:Key="Icon.Star" Stroke="M8 1.8 L9.9 5.8 L14.2 6.3 L11 9.3 L11.9 13.6 L8 11.4 L4.1 13.6 L5 9.3 L1.8 6.3 L6.1 5.8 Z" />
|
||||
<ui:IconData x:Key="Icon.StarFilled" Fill="M8 1.8 L9.9 5.8 L14.2 6.3 L11 9.3 L11.9 13.6 L8 11.4 L4.1 13.6 L5 9.3 L1.8 6.3 L6.1 5.8 Z" />
|
||||
<ui:IconData x:Key="Icon.StillFrame" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M4.5 2.5 V13.5 M11.5 2.5 V13.5 M1.5 6 H4.5 M1.5 10 H4.5 M11.5 6 H14.5 M11.5 10 H14.5" Fill="M6.5 5.5 H9.5 A0.5 0.5 0 0 1 10 6.0 V10.0 A0.5 0.5 0 0 1 9.5 10.5 H6.5 A0.5 0.5 0 0 1 6 10.0 V6.0 A0.5 0.5 0 0 1 6.5 5.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Stop" Fill="M5.0 3.5 H11.0 A1.5 1.5 0 0 1 12.5 5.0 V11.0 A1.5 1.5 0 0 1 11.0 12.5 H5.0 A1.5 1.5 0 0 1 3.5 11.0 V5.0 A1.5 1.5 0 0 1 5.0 3.5 Z" />
|
||||
<ui:IconData x:Key="Icon.Straighten" Stroke="M1.5 12.5 H14.5 M2.5 12.5 L13 6 M8.45 8.81 A7 7 0 0 1 9.50 12.50" />
|
||||
<ui:IconData x:Key="Icon.SuccessCircle" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5 8.3 L7.1 10.3 L11 6" />
|
||||
@@ -103,6 +107,7 @@
|
||||
<ui:IconData x:Key="Icon.Users" Stroke="M5 5 A3 3 0 1 0 11 5 A3 3 0 1 0 5 5 Z M2.5 14 A5.5 5.5 0 0 1 13.5 14" />
|
||||
<ui:IconData x:Key="Icon.Vectors" Stroke="M2.5 12.5 L7 8 M7 8 H4.5 M7 8 V10.5 M9 7 L13.5 2.5 M13.5 2.5 H11 M13.5 2.5 V5" />
|
||||
<ui:IconData x:Key="Icon.Verify" Stroke="M8 1.5 L13.5 3.5 V7.5 C13.5 11 11 13.3 8 14.5 C5 13.3 2.5 11 2.5 7.5 V3.5 Z M5.5 8 L7.3 9.8 L10.6 6.3" />
|
||||
<ui:IconData x:Key="Icon.Videos" Stroke="M3.0 4 H11.0 A1.5 1.5 0 0 1 12.5 5.5 V12.5 A1.5 1.5 0 0 1 11.0 14 H3.0 A1.5 1.5 0 0 1 1.5 12.5 V5.5 A1.5 1.5 0 0 1 3.0 4 Z M4.5 1.5 H13 A1.5 1.5 0 0 1 14.5 3 V11.5" Fill="M5.5 6.5 L9.5 9 L5.5 11.5 Z" />
|
||||
<ui:IconData x:Key="Icon.ViewGrid" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
||||
<ui:IconData x:Key="Icon.ViewList" Stroke="M5.5 4 H13.5 M5.5 8 H13.5 M5.5 12 H13.5 M2.5 4 H2.6 M2.5 8 H2.6 M2.5 12 H2.6" IsDirectional="True" />
|
||||
<ui:IconData x:Key="Icon.ViewTimeline" Stroke="M2 13.5 H14 M3.5 11 V8 M6 11 V5 M8.5 11 V7 M11 11 V3.5 M13.5 11 V9" />
|
||||
|
||||
Reference in new issue
Block a user