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

+23 -6
View File
@@ -467,7 +467,7 @@ internal sealed class SyncTransfers(SyncService sync)
{
var sha = await ChronosClient.HashFileAsync(file, ct).ConfigureAwait(false);
await remote.UploadRenderAsync(link.RemoteId, file, new RenderUploadRequest(render.Id, Path.GetFileName(file), new FileInfo(file).Length, sha,
render.PresetName, render.Codec, render.Width, render.Height, render.Fps, render.DurationSeconds, render.ProducedBy), ct).ConfigureAwait(false);
render.PresetName, render.Codec, render.Width, render.Height, render.Fps, render.DurationSeconds, render.ProducedBy, Kind: render.Kind), ct).ConfigureAwait(false);
}
else
{
@@ -499,7 +499,7 @@ internal sealed class SyncTransfers(SyncService sync)
await progress.ReportAsync().ConfigureAwait(false);
foreach (var render in wanted)
{
var (part, name) = await FetchRenderAsync(remote, render, staging, ct).ConfigureAwait(false);
var (part, name, sha) = await FetchRenderAsync(remote, render, staging, ct).ConfigureAwait(false);
var filed = await FileRenderAsync(sync.Archives, db, local, paths, part, name, new Render
{
Id = render.Id,
@@ -513,6 +513,9 @@ internal sealed class SyncTransfers(SyncService sync)
DurationSeconds = render.DurationSeconds,
Created = render.Created,
ProducedBy = render.ProducedBy,
// As it arrived (checked against the server's when it records one), so a copy here is verified against it.
Sha256 = sha,
Kind = render.Kind,
}, ct).ConfigureAwait(false);
if (filed is null) throw new InvalidOperationException(Loc.L("Errors.Archive.FolderMoved"));
await progress.StepAsync().ConfigureAwait(false);
@@ -562,23 +565,37 @@ internal sealed class SyncTransfers(SyncService sync)
return (string?)relative;
}, cancellationToken);
/// <summary>A render's file in staging (resumed with Range; started over once if the partial copy no longer fits) and the name the server gives it.</summary>
private static async Task<(string Part, string Name)> FetchRenderAsync(ISyncRemote remote, RenderDto render, string staging, CancellationToken cancellationToken)
/// <summary>
/// A render's file in staging (resumed with Range; started over once if the partial copy no longer fits), the name the
/// server gives it and its SHA-256 as it arrived (owner review 1, R9: copies and restores are verified against it). A
/// file that does not match the SHA-256 the server records is fetched again once from the start, then refused.
/// </summary>
/// <exception cref="InvalidDataException">The file arrived twice unlike the server's SHA-256 (<c>Errors.Sync.Hash</c>).</exception>
private static async Task<(string Part, string Name, string Sha256)> FetchRenderAsync(ISyncRemote remote, RenderDto render, string staging,
CancellationToken cancellationToken)
{
var part = Path.Combine(staging, render.Id.ToString("N") + ".part");
var expected = render.Sha256 is { Length: > 0 } recorded ? recorded.ToLowerInvariant() : null;
var hashFailures = 0;
for (var attempt = 1; ; attempt++)
{
string? name;
try
{
string? name;
await using (var file = new FileStream(part, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
name = await remote.DownloadRenderAsync(render.Id, file, cancellationToken).ConfigureAwait(false);
return (part, SafeFileName(name) ?? render.Id.ToString("N"));
}
catch (ChronosApiException ex) when (ex.Status == HttpStatusCode.RequestedRangeNotSatisfiable && attempt == 1)
{
File.Delete(part);
continue;
}
var fileName = SafeFileName(name) ?? render.Id.ToString("N");
var sha = await ChronosClient.HashFileAsync(part, cancellationToken).ConfigureAwait(false);
if (expected is null || sha == expected) return (part, fileName, sha);
// A partial copy resumed onto other bytes, or damage on the way: once more from the start, then refused.
File.Delete(part);
if (++hashFailures == 2) throw new InvalidDataException(Loc.L("Errors.Sync.Hash", fileName));
}
}