feat(P8): integrate phase 5 (workspace stills, strings, prune)
Wire the phase 5 parcels into one working whole. - Save frame works in a workspace project. WorkspaceSequenceSource now makes still jobs (IProjectStills) routed like its renders: with the originals on this PC, a WorkspaceRender still into exports/; with proxies only, the home's still job with the portable settings and the project id. The tooltip for a source that saves no frames is now a real string. - The Export footer has Save project file again for library sequences; workspace projects keep it in their project menu only. - Sync render downloads are hashed and compared with the server's sha256 (one retry, then the job fails without filing the file), and uploads and downloads carry the render kind, so a saved frame no longer counts as a recent preset. - Add the missing en/it strings: still frame out of the sequence (Core and both job handlers), keyframes not applicable, workspace stills, Videos refresh / clear sequence / play-from-server tips, the videos-folder creation error, and the admin panel kind labels, play and trash tips. - Delete the export history, batch and card strings no longer used from English and prune them from every culture. - Videos: the sequence chip clears only the sequence filter (desktop and admin panel), the desktop remembers cards or list, and a Refresh button. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c4924c122e
commit
6d87a1bc6d
111 files changed
+459
-754
No files matched your search
@@ -430,7 +430,11 @@
|
||||
ToolTip="{Binding SendAgainToolTip}" ToolTipService.ShowOnDisabled="True" Margin="0,0,6,0"
|
||||
Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Text="{l:Loc Editor.Render.NotSent}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}" VerticalAlignment="Center"
|
||||
ToolTip="{Binding UnsentToolTip}" Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" />
|
||||
ToolTip="{Binding UnsentToolTip}" Visibility="{Binding HasUnsent, Converter={StaticResource BoolToVisibility}}" Margin="0,0,12,0" />
|
||||
<!-- A .chronos project file that opens this sequence with these settings (BRIEF §18); a workspace project has it in its project ▾ menu. -->
|
||||
<Button Style="{StaticResource Button.Link}" Content="{l:Loc Editor.ProjectFile.Save}" Command="{Binding SaveProjectCommand}"
|
||||
ToolTip="{Binding SaveProjectToolTip}" ToolTipService.ShowOnDisabled="True"
|
||||
Visibility="{Binding Editor.HasProject, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -266,8 +266,8 @@ public sealed class EditorSession : IAsyncDisposable
|
||||
|
||||
/// <summary>
|
||||
/// A source can save one frame as an image (owner review 1, R8, "Save frame"): a sequence of this PC or of a server, or a
|
||||
/// source that makes its own still jobs (<see cref="IProjectStills"/>). A workspace project renders at its home with
|
||||
/// its portable settings (<see cref="IProjectRenders"/>) and saves no frame until it makes still jobs of its own.
|
||||
/// source that makes its own still jobs (<see cref="IProjectStills"/>, a workspace project). A source that renders
|
||||
/// elsewhere (<see cref="IProjectRenders"/>) without still jobs of its own saves none.
|
||||
/// </summary>
|
||||
public bool CanSaveFrames => Source is IProjectStills or not IProjectRenders;
|
||||
|
||||
|
||||
@@ -696,7 +696,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Why the frame under the cursor cannot be saved now (<see cref="RenderMenu.SaveFrameBlockedReason"/>): out of date or
|
||||
/// read-only, no frame the render keeps under the cursor, a workspace project, no right to render on the server or a
|
||||
/// read-only, no frame the render keeps under the cursor, a source that saves no frames, no right to render on the server or a
|
||||
/// server too old for still jobs (format 3), a wrong file name; null when it can.
|
||||
/// </summary>
|
||||
public string? SaveFrameBlockedReason
|
||||
@@ -705,7 +705,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
{
|
||||
var hasFrame = FrameCount > 0 && !Session.Project.ExcludedFrames.Contains(CurrentIndex) && !Session.Content.NotRenderable().Contains(CurrentIndex);
|
||||
string? server = null;
|
||||
if (IsRemote && Session.CanSaveFrames)
|
||||
// A workspace project saving the frame on this PC from its originals (phase 5c) uses this PC's engine: the
|
||||
// server's format does not decide, as for its renders.
|
||||
if (IsRemote && Session.CanSaveFrames && Session.Source is not IProjectRenders { RendersLocally: true })
|
||||
{
|
||||
var sync = Shell.Services.Sync;
|
||||
server = !sync.CanRender ? Loc.L("Tooltips.Editor.Render.NoRight", ServerName)
|
||||
@@ -836,7 +838,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
|
||||
if (Session.StillRequests(RenderExport with { Batch = [] }, codec, index) is not [_, ..] requests) return;
|
||||
foreach (var request in requests) await Session.SubmitAsync(request);
|
||||
var label = requests[0].Label + Loc.Separator + EditorText.Position(index, FrameCount);
|
||||
if (IsRemote) Shell.Notify(Loc.L("Editor.Still.Queued"), label);
|
||||
if (IsRemote && Session.Source is not IProjectRenders { RendersLocally: true }) Shell.Notify(Loc.L("Editor.Still.Queued"), label);
|
||||
else Shell.Notify(Loc.L("Editor.Still.Queued"), label, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
|
||||
}
|
||||
|
||||
|
||||
@@ -80,10 +80,14 @@ public static class ExportRules
|
||||
/// <summary>Only the hardware codecs have a rate control, a keyframe interval and B-frames to choose.</summary>
|
||||
public static bool HasRateControl(VideoCodec codec) => !VideoCodecInfo.IsManaged(codec);
|
||||
|
||||
/// <summary>Why <paramref name="codec"/> has no rate control or keyframe interval to choose; null when it has.</summary>
|
||||
/// <summary>Why <paramref name="codec"/> has no rate control to choose; null when it has.</summary>
|
||||
public static string? RateControlBlocked(VideoCodec codec) =>
|
||||
HasRateControl(codec) ? null : Loc.L("Tooltips.Export.RateControlNA", Loc.L("Export.Codec." + codec));
|
||||
|
||||
/// <summary>Why <paramref name="codec"/> has no keyframe interval to choose (as it has no rate control); null when it has.</summary>
|
||||
public static string? KeyframesBlocked(VideoCodec codec) =>
|
||||
HasRateControl(codec) ? null : Loc.L("Tooltips.Export.KeyframesNA", Loc.L("Export.Codec." + codec));
|
||||
|
||||
/// <summary>
|
||||
/// Why <paramref name="codec"/> with <paramref name="profile"/> takes no B-frames (Baseline, MJPEG, GIF, APNG and the
|
||||
/// image sequences); null when it does.
|
||||
|
||||
@@ -476,7 +476,7 @@ public sealed class ExportTab : EditorTab
|
||||
}
|
||||
}
|
||||
|
||||
public string KeyframesToolTip => ExportRules.RateControlBlocked(Resolved.Codec) ?? Loc.L("Tooltips.Export.Keyframes");
|
||||
public string KeyframesToolTip => ExportRules.KeyframesBlocked(Resolved.Codec) ?? Loc.L("Tooltips.Export.Keyframes");
|
||||
|
||||
/// <summary>Auto (the preset's), then 0 to 4.</summary>
|
||||
public IReadOnlyList<Choice> BFrameChoices { get => _bFrameChoices; private set => Set(ref _bFrameChoices, value); }
|
||||
|
||||
@@ -126,6 +126,8 @@ public sealed class RemoteSequenceSource : ISequenceSource
|
||||
Bytes = r.Bytes,
|
||||
Created = r.Created,
|
||||
ProducedBy = r.ProducedBy,
|
||||
Sha256 = r.Sha256,
|
||||
Kind = r.Kind,
|
||||
}).ToList();
|
||||
var (deep, otherFrames) = Report(report, frames.Count);
|
||||
return new SequenceContent(sequence, frames, project, LightAnalyzer.Analyze(frames), deep, context.SourceWidth, context.SourceHeight, null, renders, [])
|
||||
|
||||
@@ -287,8 +287,7 @@ public static class RenderMenu
|
||||
if (outdated) return Loc.L("Tooltips.Editor.Outdated", server);
|
||||
if (readOnly) return Loc.L("Tooltips.Export.StillReadOnly");
|
||||
if (!hasFrame) return Loc.L("Tooltips.Export.StillNeedsFrame");
|
||||
// Missing key Tooltips.Export.StillWorkspace (a workspace project saves no frame yet): the closest reason until P8 adds it.
|
||||
if (!sourceSavesFrames) return Loc.L("Tooltips.Export.StillReadOnly");
|
||||
if (!sourceSavesFrames) return Loc.L("Tooltips.Export.StillWorkspace");
|
||||
if (serverReason is not null) return serverReason;
|
||||
return nameError is null ? null : Loc.L("Tooltips.Editor.Render.NameError", nameError);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Render;
|
||||
using Chronos.Core.Video;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Archiving.Jobs;
|
||||
@@ -74,7 +75,7 @@ public sealed class WorkspaceServerHome(Func<IRemoteSequenceApi?> connect, Func<
|
||||
/// are read from the server when it can be reached (else the copy the workspace took), and "Update media" is offered when
|
||||
/// the server's frames moved, or it has the proxy of a frame a thumbnail stands in for.
|
||||
/// </summary>
|
||||
public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
|
||||
public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders, IProjectStills
|
||||
{
|
||||
private const int JobsListed = 200;
|
||||
|
||||
@@ -292,6 +293,8 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
|
||||
Bytes = r.Bytes,
|
||||
Created = r.Created,
|
||||
ProducedBy = r.ProducedBy,
|
||||
Sha256 = r.Sha256,
|
||||
Kind = r.Kind,
|
||||
}).ToList() ?? [];
|
||||
renders = [.. renders.Concat(UnsentOf(session.Project, home.SequenceId)).OrderByDescending(r => r.Created)];
|
||||
var (deep, otherFrames) = ServerReport(report, session.Project.AnalysisPath, frames.Count);
|
||||
@@ -618,6 +621,35 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
|
||||
];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Save frame" of a workspace project (owner review 1, R8, decision 12), routed as its renders are: media holding the
|
||||
/// originals save the frame on this PC into the project's <c>exports/</c> (a <see cref="JobKind.WorkspaceRender"/> still,
|
||||
/// recorded in its ledger and sent home after, naming the head version when it holds these settings); media of proxies
|
||||
/// have the home save it from its originals (this PC's archive, or the server). Either way the job carries the project's
|
||||
/// portable settings (positions parked by photo, placed on the frames that render) and the project, the frame by its
|
||||
/// position in the media and by its photo, whose hash wins at a home whose frames are in another order.
|
||||
/// </summary>
|
||||
public IReadOnlyList<ArchiveJobRequest> StillRequests(Sequence sequence, ProjectSettings project, ExportSettings export, VideoCodec codec, int frameIndex,
|
||||
string? photoSha256, int sourceWidth, int sourceHeight)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sequence);
|
||||
ArgumentNullException.ThrowIfNull(project);
|
||||
ArgumentNullException.ThrowIfNull(export);
|
||||
var portable = ProjectContent.ToPortable(project with { Export = export }, Photos);
|
||||
var request = ProcessingJobs.Still(sequence, export, codec, frameIndex, photoSha256, sourceWidth, sourceHeight, project with { Export = export });
|
||||
var parameters = JsonSerializer.Deserialize(request.ParametersJson!, ProtocolJson.Default.RenderJobParameters)!
|
||||
with
|
||||
{ SettingsJson = portable, ProjectId = ProjectId, ProjectVersionId = null };
|
||||
if (RendersLocally && Workspace is { } workspace)
|
||||
{
|
||||
var head = HeadVersion(portable);
|
||||
var json = JsonSerializer.Serialize(parameters with { ProjectVersionId = head }, ProtocolJson.Default.RenderJobParameters);
|
||||
var home = workspace.Home;
|
||||
return [WorkspaceJobs.Render(home.SequenceId, request.Label ?? sequence.DisplayTitle, _sync.Store.Root, ProjectId, head, json, home.IsArchive ? null : home.Server)];
|
||||
}
|
||||
return [request with { ParametersJson = JsonSerializer.Serialize(parameters, ProtocolJson.Default.RenderJobParameters) }];
|
||||
}
|
||||
|
||||
/// <summary>The id of the newest version the workspace holds when it holds <paramref name="portable"/> (any line ends); null otherwise.</summary>
|
||||
private Guid? HeadVersion(string portable)
|
||||
{
|
||||
@@ -657,6 +689,8 @@ public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders
|
||||
ProducedBy = Environment.MachineName,
|
||||
ProjectId = e.ProjectId,
|
||||
ProjectVersionId = e.ProjectVersionId,
|
||||
Sha256 = e.Sha256,
|
||||
Kind = e.Kind,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -164,6 +164,9 @@ public sealed class AppSettings
|
||||
public LibraryLayout LibraryLayout { get; set; } = LibraryLayout.Grid;
|
||||
public SequenceSort LibrarySort { get; set; } = SequenceSort.Newest;
|
||||
|
||||
/// <summary>The Videos section as cards (<see cref="LibraryLayout.Grid"/>) or as a list (<see cref="LibraryLayout.List"/>).</summary>
|
||||
public LibraryLayout VideosLayout { get; set; } = LibraryLayout.Grid;
|
||||
|
||||
// ---- Rendering ----
|
||||
public QualityProfile Quality { get; set; } = QualityProfile.Balanced;
|
||||
|
||||
|
||||
@@ -1289,7 +1289,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or NotSupportedException)
|
||||
{
|
||||
Log.Warning("settings", $"The videos folder could not be created: {ex.Message}");
|
||||
Shell.ReportError(ex);
|
||||
Shell.Notify(Loc.L("Errors.Videos.FolderCreate", _s.VideosFolder), ErrorText.For(ex), isError: true);
|
||||
return;
|
||||
}
|
||||
ShellActions.Reveal(_s.VideosFolder);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
-->
|
||||
<ContextMenu x:Key="Menu.Video" x:Shared="False">
|
||||
<MenuItem Header="{l:Loc Videos.Play}" Command="{Binding PlacementTarget.Tag.PlayCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}" ToolTip="{l:Loc Tooltips.Videos.Play}" ToolTipService.ShowOnDisabled="True" />
|
||||
CommandParameter="{Binding}" ToolTip="{Binding PlayToolTip}" ToolTipService.ShowOnDisabled="True" />
|
||||
<MenuItem Header="{l:Loc Videos.ShowInFolder}" Command="{Binding PlacementTarget.Tag.ShowInFolderCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}" ToolTip="{l:Loc Tooltips.Videos.ShowInFolder}" ToolTipService.ShowOnDisabled="True" />
|
||||
<MenuItem Header="{l:Loc Videos.Copy}" Command="{Binding PlacementTarget.Tag.CopyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
@@ -86,6 +86,7 @@
|
||||
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="260" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox VerticalAlignment="Top" Margin="0,12,0,0" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
||||
ui:Field.Placeholder="{l:Loc Videos.Search}" ToolTip="{l:Loc Tooltips.Videos.Search}" AutomationProperties.Name="{l:Loc Videos.Search}" />
|
||||
@@ -106,12 +107,14 @@
|
||||
<v:SegmentedItem Glyph="{StaticResource Icon.ViewGrid}" ToolTip="{l:Loc Tooltips.Videos.View}" AutomationProperties.Name="{l:Loc Videos.View.Grid}" />
|
||||
<v:SegmentedItem Glyph="{StaticResource Icon.ViewList}" ToolTip="{l:Loc Tooltips.Videos.View}" AutomationProperties.Name="{l:Loc Videos.View.List}" />
|
||||
</v:SegmentedControl>
|
||||
<Button Grid.Column="3" Style="{StaticResource Button.Quick}" VerticalAlignment="Top" Margin="8,14,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Refresh}"
|
||||
Command="{Binding RefreshCommand}" ToolTip="{l:Loc Tooltips.Videos.Refresh}" AutomationProperties.Name="{l:Loc Videos.Refresh}" />
|
||||
</Grid>
|
||||
|
||||
<!-- The sequence the list is narrowed to (a chip that clears the filters), and why the server's videos are not listed. -->
|
||||
<!-- The sequence the list is narrowed to (a chip that clears that filter alone), and why the server's videos are not listed. -->
|
||||
<WrapPanel Grid.Row="1" Grid.ColumnSpan="2" Margin="20,0,20,4">
|
||||
<Button Style="{StaticResource Button.Chip}" Content="{Binding SequenceFilterText}" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}" Command="{Binding ClearFiltersCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Library.ClearFilters}" Visibility="{Binding IsSequenceFiltered, Converter={StaticResource BoolToVisibility}}" Margin="0,0,12,4" />
|
||||
<Button Style="{StaticResource Button.Chip}" Content="{Binding SequenceFilterText}" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}" Command="{Binding ClearSequenceCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Videos.ClearSequence}" Visibility="{Binding IsSequenceFiltered, Converter={StaticResource BoolToVisibility}}" Margin="0,0,12,4" />
|
||||
<ui:StatusGlyph Kind="Offline" Text="{Binding ServerStatusText}" ToolTip="{Binding ServerStatusToolTip}" VerticalAlignment="Center" Margin="0,0,12,4"
|
||||
Visibility="{Binding IsServerLimited, Converter={StaticResource BoolToVisibility}}" />
|
||||
<ProgressBar Width="120" Height="4" IsIndeterminate="True" VerticalAlignment="Center" Margin="0,0,12,4"
|
||||
@@ -135,7 +138,7 @@
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Play}"
|
||||
Command="{Binding DataContext.PlayCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
|
||||
ToolTip="{l:Loc Tooltips.Videos.Play}" AutomationProperties.Name="{l:Loc Videos.Play}" />
|
||||
ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{l:Loc Videos.Play}" />
|
||||
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}"
|
||||
Command="{Binding DataContext.ShowInFolderCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"
|
||||
ToolTip="{l:Loc Tooltips.Videos.ShowInFolder}" AutomationProperties.Name="{l:Loc Videos.ShowInFolder}" />
|
||||
@@ -231,7 +234,7 @@
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding SelectionText}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,12,8" Typography.NumeralAlignment="Tabular" />
|
||||
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="0,0,12,8" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Videos.Play}" Command="{Binding PlayCommand}" ToolTip="{l:Loc Tooltips.Videos.Play}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Videos.Play}" Command="{Binding PlayCommand}" ToolTip="{Binding PlayToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Videos.ShowInFolder}" Command="{Binding ShowInFolderCommand}" ToolTip="{l:Loc Tooltips.Videos.ShowInFolder}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{Binding CopyText}" Command="{Binding CopyCommand}" ToolTip="{Binding CopyToolTip}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Content="{l:Loc Videos.CopyOnServer}" Command="{Binding CopyOnServerCommand}" ToolTip="{Binding CopyOnServerToolTip}" />
|
||||
|
||||
@@ -77,6 +77,9 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
|
||||
OpenInEditCommand = new RelayCommand(p => OpenInEdit(Target(p)), p => Target(p) is { } row && CanOpen(row.Entry));
|
||||
SendCommand = new AsyncRelayCommand((p, _) => SendAsync(Targets(p)), p => Targets(p).Any(r => r.Entry.IsUnsent));
|
||||
ClearFiltersCommand = new RelayCommand(ClearFilters, () => Filter.IsFiltered);
|
||||
ClearSequenceCommand = new RelayCommand(() => ShowSequence(null), () => IsSequenceFiltered);
|
||||
RefreshCommand = new AsyncRelayCommand(RefreshAsync);
|
||||
_layoutIndex = services.Settings.VideosLayout == LibraryLayout.List ? 1 : 0;
|
||||
ClearSelectionCommand = new RelayCommand(() =>
|
||||
{
|
||||
foreach (var row in _rows) row.IsSelected = false;
|
||||
@@ -160,13 +163,14 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
|
||||
/// <summary>Videos, none of which the filters keep: "No videos" and Clear filters.</summary>
|
||||
public bool IsNoMatch => !_isLoading && _entries.Count > 0 && _rows.Count == 0;
|
||||
|
||||
/// <summary>The cards (0) or the list (1).</summary>
|
||||
/// <summary>The cards (0) or the list (1), kept for the next run (Settings: <see cref="AppSettings.VideosLayout"/>).</summary>
|
||||
public int LayoutIndex
|
||||
{
|
||||
get => _layoutIndex;
|
||||
set
|
||||
{
|
||||
if (value is < 0 or > 1 || !Set(ref _layoutIndex, value)) return;
|
||||
Shell.Services.Settings.VideosLayout = value == 1 ? LibraryLayout.List : LibraryLayout.Grid;
|
||||
OnPropertyChanged(nameof(IsGrid));
|
||||
OnPropertyChanged(nameof(IsList));
|
||||
}
|
||||
@@ -249,6 +253,12 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
|
||||
|
||||
public ICommand ClearFiltersCommand { get; }
|
||||
|
||||
/// <summary>The sequence chip: the videos of every sequence again, the other filters kept.</summary>
|
||||
public ICommand ClearSequenceCommand { get; }
|
||||
|
||||
/// <summary>Reads this PC's, the server's and the workspace's videos again (<see cref="RefreshAsync"/>).</summary>
|
||||
public ICommand RefreshCommand { get; }
|
||||
|
||||
/// <summary>Narrows the list to the videos of one sequence (null: every sequence).</summary>
|
||||
public void ShowSequence(Guid? sequenceId, string? title = null)
|
||||
{
|
||||
@@ -296,6 +306,10 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
|
||||
// ---- Actions ----
|
||||
|
||||
public ICommand PlayCommand { get; }
|
||||
|
||||
/// <summary>The toolbar's Play tooltip: why the selection does not play here, else what Play does.</summary>
|
||||
public string PlayToolTip => SelectedRows is [var one] ? one.PlayToolTip : Loc.L("Tooltips.Videos.Play");
|
||||
|
||||
public ICommand ShowInFolderCommand { get; }
|
||||
public ICommand CopyCommand { get; }
|
||||
public ICommand CopyOnServerCommand { get; }
|
||||
@@ -531,6 +545,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
|
||||
OnPropertyChanged(nameof(SelectedRows));
|
||||
OnPropertyChanged(nameof(SelectionText));
|
||||
OnPropertyChanged(nameof(CopyText));
|
||||
OnPropertyChanged(nameof(PlayToolTip));
|
||||
OnPropertyChanged(nameof(CopyToolTip));
|
||||
OnPropertyChanged(nameof(CopyOnServerToolTip));
|
||||
OnPropertyChanged(nameof(DeleteToolTip));
|
||||
|
||||
@@ -89,6 +89,18 @@ public static class VideoText
|
||||
public static string FolderReason(string problem) =>
|
||||
problem == VideoErrors.FolderUnset ? Loc.L("Tooltips.Videos.FolderUnset") : Loc.L("Errors.Videos.FolderInsideArchive");
|
||||
|
||||
/// <summary>
|
||||
/// Play's tooltip for <paramref name="entry"/>: what Play does for a file on this PC; for a video only the server holds,
|
||||
/// that it plays here once copied to this PC; for a file that is gone, that it is missing.
|
||||
/// </summary>
|
||||
public static string PlayToolTip(VideoEntry entry)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(entry);
|
||||
if (entry.HasLocalFile) return Loc.L("Tooltips.Videos.Play");
|
||||
if (entry.Missing) return Loc.L("Tooltips.Videos.Missing");
|
||||
return entry.IsOnServer ? Loc.L("Tooltips.Videos.PlayServer") : Loc.L("Tooltips.Videos.Play");
|
||||
}
|
||||
|
||||
/// <summary>"In use by a job", "Not found".</summary>
|
||||
public static string BlockReason(string reason) =>
|
||||
reason == VideoBlockReasons.Busy ? Loc.L("Videos.Blocked.Busy") : Loc.L("Videos.Blocked.NotFound");
|
||||
@@ -119,6 +131,12 @@ public sealed class VideoRowViewModel(VideoEntry entry) : ObservableObject
|
||||
/// <summary>The card's and the row's tooltip: what it is, then how to select it.</summary>
|
||||
public string ToolTip => Entry.IsUnsent ? Loc.L("Tooltips.Videos.WorkspaceRow") : Loc.L("Tooltips.Videos.Select");
|
||||
|
||||
/// <summary>
|
||||
/// Play's tooltip: what it does, or why it waits (a server's video plays here once it is copied to this PC, a file
|
||||
/// that is gone plays nowhere).
|
||||
/// </summary>
|
||||
public string PlayToolTip => VideoText.PlayToolTip(Entry);
|
||||
|
||||
/// <summary>The file name, left to right in every language.</summary>
|
||||
public string FileNameText => Formatting.LeftToRight(Entry.FileName);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public sealed record RenderSetup
|
||||
options ??= RenderOptions.Default;
|
||||
if (input.Frames.Count != input.Source.FrameCount) throw new ArgumentException("One metadata entry per source frame is required.", nameof(input));
|
||||
if (target.StillFrame is { } wanted && (wanted < 0 || wanted >= input.Source.FrameCount))
|
||||
throw new RenderException("Tooltips.Export.StillNeedsFrame", $"Frame {wanted} is not in the sequence of {input.Source.FrameCount} frames.");
|
||||
throw new RenderException("Export.Render.StillMissing", $"Frame {wanted} is not in the sequence of {input.Source.FrameCount} frames.");
|
||||
var project = input.Project;
|
||||
var geometry = RenderGeometry.Create(project.Camera, target.Export, input.Source.Width, input.Source.Height,
|
||||
corrections?.StabilizationZoom ?? 1, options.MaxWorkingLongEdge);
|
||||
|
||||
@@ -62,7 +62,7 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
// A still saves one frame through the job's preset alone: a batch is a video's.
|
||||
var all = parameters.IsStill ? [new ExportTarget(ExportResolver.Resolve(export), parameters.PresetName)] : Targets(export, parameters.PresetName);
|
||||
var still = parameters.IsStill
|
||||
? SequenceRender.StillIndex(frames, parameters.StillFrame, parameters.StillPhoto) ?? throw new InvalidOperationException(Loc.L("Export.Render.NoFrames"))
|
||||
? SequenceRender.StillIndex(frames, parameters.StillFrame, parameters.StillPhoto) ?? throw new InvalidOperationException(Loc.L("Export.Render.StillMissing"))
|
||||
: -1;
|
||||
var resume = RenderCheckpoint.Parse(context.Checkpoint);
|
||||
var done = resume.Done.ToList();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ internal sealed class WorkspaceRenderJobHandler(ChronosDatabase db, ArchiveServi
|
||||
? [new ExportTarget(ExportResolver.Resolve(projectSettings.Export), render.PresetName)]
|
||||
: RenderJobHandler.Targets(projectSettings.Export, render.PresetName);
|
||||
var still = render.IsStill
|
||||
? SequenceRender.StillIndex(frames, render.StillFrame, render.StillPhoto) ?? throw new InvalidOperationException(Loc.L("Export.Render.NoFrames"))
|
||||
? SequenceRender.StillIndex(frames, render.StillFrame, render.StillPhoto) ?? throw new InvalidOperationException(Loc.L("Export.Render.StillMissing"))
|
||||
: -1;
|
||||
var resume = RenderCheckpoint.Parse(context.Checkpoint);
|
||||
var done = resume.Done.ToList();
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
|
||||
}, () => {});
|
||||
|
||||
actions.innerHTML = `
|
||||
<a class="btn" href="#/library?view=trash" data-i18n-title="Admin.Library.Trash.Tip">${icons.trash}<span data-i18n="Admin.Library.Trash"></span></a>
|
||||
<a class="btn" href="#/library?view=trash" data-i18n-title="Admin.Videos.Trash.Tip">${icons.trash}<span data-i18n="Admin.Library.Trash"></span></a>
|
||||
<button class="btn icon" id="refresh" data-i18n-title="Admin.Library.Refresh.Tip">${icons.refresh}</button>`;
|
||||
applyStrings(actions);
|
||||
actions.querySelector("#refresh").addEventListener("click", () => load());
|
||||
@@ -230,10 +230,16 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
|
||||
withChosen(years, filters.year).reverse().map((y) => option(y, y, filters.year)).join("");
|
||||
root.querySelectorAll(".toolbar select").forEach((s) => s.classList.toggle("active", s.id !== "sort" && s.value !== ""));
|
||||
root.querySelector("#clear").hidden = !isFiltered();
|
||||
// One sequence's videos ("All videos" of a sequence page): its title, which opens it.
|
||||
// One sequence's videos ("All videos" of a sequence page): its title, which opens it, and × for every sequence's
|
||||
// videos again (the other filters stay).
|
||||
const title = filters.sequence ? rows.find((v) => v.sequenceId === filters.sequence)?.sequenceTitle : null;
|
||||
root.querySelector("#sequence-filter").innerHTML = filters.sequence ? `<a class="pill" href="#/library?id=${attr(encodeURIComponent(filters.sequence))}" dir="auto"
|
||||
title="${attr(t("Admin.Library.Open.Tip"))}">${escapeHtml(title ?? "…")}</a>` : "";
|
||||
const chip = root.querySelector("#sequence-filter");
|
||||
chip.innerHTML = filters.sequence ? `<a class="pill" href="#/library?id=${attr(encodeURIComponent(filters.sequence))}" dir="auto"
|
||||
title="${attr(t("Admin.Library.Open.Tip"))}">${escapeHtml(title ?? "…")}</a>
|
||||
<button class="btn icon small subtle" id="clear-sequence" data-i18n-title="Admin.Videos.Sequence.Clear.Tip"
|
||||
aria-label="${attr(t("Admin.Videos.Sequence.Clear.Tip"))}">${icons.close}</button>` : "";
|
||||
applyStrings(chip);
|
||||
chip.querySelector("#clear-sequence")?.addEventListener("click", () => setFilter("sequence", ""));
|
||||
setMeta(title ?? "");
|
||||
}
|
||||
|
||||
@@ -332,7 +338,8 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
|
||||
<strong class="nowrap" role="status">${escapeHtml(t("Admin.Videos.Selected", formatNumber(n)))}</strong>
|
||||
${n < rows.length ? `<button class="btn small subtle" id="mass-all" data-mass="all" data-i18n="Admin.Sequence.SelectAll" data-i18n-title="Admin.Videos.SelectAll.Tip"></button>` : ""}
|
||||
<span class="spacer"></span>
|
||||
${one ? `<button class="btn small" id="mass-play" data-mass="play" data-i18n-title="Admin.Videos.Play.Tip">${icons.play}<span data-i18n="Admin.Videos.Play"></span></button>` : ""}
|
||||
<button class="btn small" id="mass-play" data-mass="play" data-i18n-title="${one ? "Admin.Videos.Play.Tip" : "Admin.Videos.Play.One.Tip"}"
|
||||
${one ? "" : "disabled"}>${icons.play}<span data-i18n="Admin.Videos.Play"></span></button>
|
||||
<button class="btn small" id="mass-download" data-mass="download" data-i18n-title="${one ? "Admin.Videos.Download.Tip" : "Admin.Videos.Download.One.Tip"}"
|
||||
${one ? "" : "disabled"}>${icons.download}<span data-i18n="Admin.Videos.Download"></span></button>
|
||||
<button class="btn small" id="mass-copy" data-mass="copy" data-i18n-title="${copyWhy ?? "Admin.Videos.Copy.Tip"}"
|
||||
@@ -441,7 +448,7 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
|
||||
return;
|
||||
}
|
||||
toast(t("Admin.Videos.Delete.Done", formatNumber(result.items.length)), false,
|
||||
{ label: t("Admin.Library.Trash"), tip: t("Admin.Library.Trash.Tip"), href: "#/library?view=trash" });
|
||||
{ label: t("Admin.Library.Trash"), tip: t("Admin.Videos.Trash.Tip"), href: "#/library?view=trash" });
|
||||
selection.clear();
|
||||
await load();
|
||||
}
|
||||
@@ -520,8 +527,8 @@ export function videoKind(v) {
|
||||
/** A kind in words; a newer server's kind as it is. */
|
||||
export function kindText(kind) {
|
||||
if (kind === "still") return t("Admin.Videos.Kind.Still.Label");
|
||||
if (kind === "sequence") return t("Admin.Videos.Kind.Sequence");
|
||||
if (kind === "video") return t("Admin.Sequence.Render.Video");
|
||||
if (kind === "sequence") return t("Admin.Videos.Kind.Sequence.Label");
|
||||
if (kind === "video") return t("Admin.Videos.Kind.Video.Label");
|
||||
return kind;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user