Video trash moves across volumes commit once the verified copy has its name and leave an undeletable source whole behind a .leftover marker that the next start settles; deletes rehash under the lease. Restores honour the names renders are writing, and encoders never overwrite an output. Routing floors at the stored settings' format, kindless stills read as stills, star trails restart per loop, and settings the encoder ignored become render warnings. The Videos section fits beside the player, plays downloaded server copies, names blocked videos and says why actions are off; the admin panel offers no download for sequences or missing files and names a filtered sequence from its record. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
3.3 KiB
C#
60 lines
3.3 KiB
C#
using Chronos.Core.Model;
|
|
using Chronos.Core.Project;
|
|
using Chronos.Core.Video;
|
|
using Chronos.Data.Processing;
|
|
using Chronos.Protocol;
|
|
using Chronos.Server.Jobs;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Server.Tests.Jobs;
|
|
|
|
/// <summary>Owner review 1, phase 5: a job that plays back, or saves a still, goes only to a node that reads settings format 3.</summary>
|
|
[Category("server")]
|
|
public sealed class PlaybackRoutingTests
|
|
{
|
|
private static readonly ExportSettings Mjpeg = new()
|
|
{
|
|
Preset = new Auto<string>().WithManual("mjpeg-avi"),
|
|
Overrides = new ExportOverrides { Width = 96, Height = 64 },
|
|
};
|
|
|
|
[Test]
|
|
public void APlaybackJobIsNeverGivenToAFormatTwoNode()
|
|
{
|
|
var sequence = new Sequence { Id = Guid.CreateVersion7(), ArchiveId = Guid.CreateVersion7(), Folder = "Roof", Title = "Roof" };
|
|
var playing = ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg with { Playback = new PlaybackSettings { Loops = 3 } }, 96, 64,
|
|
new ProjectSettings()).ParametersJson).Parameters;
|
|
var plain = ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64, new ProjectSettings()).ParametersJson).Parameters;
|
|
Assert.Equal((3, 1), (playing.RequiredSettingsFormat, plain.RequiredSettingsFormat));
|
|
|
|
RegisterNodeRequest Node(int format) => new("node", [new NodeEncoder("mjpeg", "managed", false, false)], 0, 0, format);
|
|
Assert.False(RenderNodeService.Renders(Node(2), playing), "a format-2 node would render it forward once");
|
|
Assert.True(RenderNodeService.Renders(Node(3), playing));
|
|
Assert.True(RenderNodeService.Renders(Node(2), plain));
|
|
|
|
// A still needs format 3 too (and an image codec no node encodes).
|
|
var still = ProcessingJobs.ReadRender(ProcessingJobs.Still(sequence, Mjpeg, VideoCodec.JpegSequence, 0, null, 96, 64, new ProjectSettings()).ParametersJson).Parameters;
|
|
Assert.False(RenderNodeService.Renders(Node(2) with { Encoders = [new NodeEncoder(still.Codec, "managed", false, false)] }, still));
|
|
}
|
|
|
|
[Test]
|
|
public void SettingsWrittenInFormatThreeNeverGoToAFormatTwoNodeEvenWhenTheJobDoesNotPlayBack()
|
|
{
|
|
// The sequence's own export plays back, so its settings text is stamped version 3; the job's preset does not.
|
|
var stored = new ProjectSettings { Export = Mjpeg with { Playback = new PlaybackSettings { Loops = 3 } } }.ToJson();
|
|
var read = ProcessingJobs.ReadSettings(stored)!;
|
|
var sequence = new Sequence { Id = Guid.CreateVersion7(), ArchiveId = Guid.CreateVersion7(), Folder = "Roof", Title = "Roof" };
|
|
var job = ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64, new ProjectSettings()).ParametersJson).Parameters;
|
|
Assert.Equal(1, job.RequiredSettingsFormat);
|
|
|
|
var routed = ProcessingJobs.Routed(job, read, 96, 64);
|
|
var split = ProcessingJobs.Split(job, 96, 64, read);
|
|
|
|
Assert.Equal(3, routed.RequiredSettingsFormat);
|
|
Assert.True(split.All(p => p.RequiredSettingsFormat == 3));
|
|
RegisterNodeRequest Node(int format) => new("node", [new NodeEncoder("mjpeg", "managed", false, false)], 0, 0, format);
|
|
Assert.False(RenderNodeService.Renders(Node(2), routed), "a format-2 node cannot parse the settings it would be handed");
|
|
Assert.True(RenderNodeService.Renders(Node(3), routed));
|
|
}
|
|
}
|