feat(P7): desktop Videos section with player, copy, delete and videos folder
Adds the Videos rail section (Ctrl+4; Archive, Jobs and Server move to Ctrl+5..7) that lists every render of this PC's archive, the signed-in server and the workspace (not sent yet) in one list merged by render id, with search, kind, codec, year, source and order filters, cards or a list, and a player pane that plays in-process and falls back to "Cannot play here". Copy to folder queues a hash-verified VideoCopy job into the new Settings > Archive > Videos folder (never inside the archive or the workspace, the reason given when unset); Delete... runs the dry run first, shows its bytes and what stays, and deletes with the plan's fingerprint. An older server, or one out of reach, leaves this PC's videos with the reason. The trash dialog restores videos entries through the videos library, and a finished VideoCopy job raises its toast. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d472dfdec1
commit
8c87a9f47f
18 files changed
+2665
-15
No files matched your search
@@ -8,6 +8,7 @@ using Chronos.App.Infrastructure;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.App.Settings;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.App.Videos;
|
||||
using Chronos.App.Workspace;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Diagnostics;
|
||||
@@ -79,7 +80,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
new(SettingsPage.General, ["Settings.General.Language", "Settings.General.Theme", .. ShowsStartup ? (string[])["Settings.General.Startup"] : [],
|
||||
"Settings.General.Notifications", .. ProductFeatures.AdsEnabled ? (string[])["Settings.General.Usage"] : []]),
|
||||
new(SettingsPage.Archive, ["Settings.Archive.Root", "Settings.Archive.Folders", "Settings.Archive.Files", "Settings.Archive.Proxies",
|
||||
"Settings.Archive.Thumbnails"]),
|
||||
"Settings.Archive.Thumbnails", "Settings.Archive.VideosFolder"]),
|
||||
new(SettingsPage.Import, ["Import.Scan.Sessions", "Import.Label.Scan", "Import.Scan.Subfolders", "Import.Scan.Verify", "Import.Label.Duplicates",
|
||||
"Import.Label.After", "Import.After.Eject"]),
|
||||
new(SettingsPage.Analysis, ["Settings.Analysis.Width", "Settings.Analysis.Night", "Settings.Analysis.Stars", "Settings.Analysis.Deep"]),
|
||||
@@ -121,6 +122,12 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Save();
|
||||
_ = OfferReorganizeAsync(UpdateArchiveAsync(a => a with { Templates = a.Templates with { File = v } }), ReorganizeParts.Files);
|
||||
}, () => Loc.L("Tooltips.Settings.FileTemplate"));
|
||||
// Where Videos › Copy to folder puts copies (owner review 1, R9): empty leaves it unset; never inside the archive or the workspace.
|
||||
VideosFolder = new EditableField(_s.VideosFolder ?? string.Empty, ValidateVideosFolder, v =>
|
||||
{
|
||||
_s.VideosFolder = v.Trim().Length == 0 ? null : Path.GetFullPath(v.Trim());
|
||||
Save();
|
||||
}, () => Loc.L("Tooltips.Settings.VideosFolder"));
|
||||
FolderTemplate.PropertyChanged += (_, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(EditableField.Text)) UpdatePreview();
|
||||
@@ -216,6 +223,8 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
});
|
||||
BrowseArchiveCommand = new RelayCommand(() => Browse(ArchiveRoot, "Settings.Archive.PickTitle"));
|
||||
BrowseCacheCommand = new RelayCommand(() => Browse(CacheFolder, "Settings.Storage.PickTitle"));
|
||||
BrowseVideosCommand = new RelayCommand(() => Browse(VideosFolder, "Settings.Archive.VideosPickTitle"));
|
||||
OpenVideosFolderCommand = new RelayCommand(OpenVideosFolder, () => !string.IsNullOrWhiteSpace(_s.VideosFolder));
|
||||
ResetMemoryCommand = new RelayCommand(() => MemoryBudget = MemoryAuto, () => !IsMemoryAuto);
|
||||
ResetParallelismCommand = new RelayCommand(() =>
|
||||
{
|
||||
@@ -400,6 +409,11 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
public EditableField FileTemplate { get; }
|
||||
public ICommand BrowseArchiveCommand { get; }
|
||||
|
||||
/// <summary>Archive › Videos folder: where Videos › Copy to folder puts copies of renders.</summary>
|
||||
public EditableField VideosFolder { get; }
|
||||
public ICommand BrowseVideosCommand { get; }
|
||||
public ICommand OpenVideosFolderCommand { get; }
|
||||
|
||||
/// <summary>"1.8 TB free".</summary>
|
||||
public string? ArchiveFreeText
|
||||
{
|
||||
@@ -1236,7 +1250,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
JobKind.Render, JobKind.Import, JobKind.Download, JobKind.UploadCommit, JobKind.Scan, JobKind.Rebuild, JobKind.Verify, JobKind.LightAnalyse,
|
||||
JobKind.DeepAnalyse, JobKind.Thumbs, JobKind.Proxies, JobKind.Maintenance, JobKind.Duplicates, JobKind.Orphans, JobKind.Adopt, JobKind.Move,
|
||||
JobKind.Backup, JobKind.Cleanup, JobKind.EmptyTrash, JobKind.Convert, JobKind.WorkspaceCopy, JobKind.WorkspaceRender, JobKind.WorkspaceSend,
|
||||
JobKind.WorkspaceMove,
|
||||
JobKind.WorkspaceMove, JobKind.VideoCopy,
|
||||
];
|
||||
|
||||
/// <summary>Stores <paramref name="level"/> for <paramref name="kind"/>, keeping only the levels that differ from the defaults.</summary>
|
||||
@@ -1259,6 +1273,28 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
? null
|
||||
: Loc.L("Errors.Number.DecimalRange", min.ToString("0.##", Loc.Culture), max.ToString("0.##", Loc.Culture));
|
||||
|
||||
/// <summary>Empty leaves the videos folder unset; a path must be absolute and outside the archive and the workspace.</summary>
|
||||
private string? ValidateVideosFolder(string text) =>
|
||||
text.Trim().Length == 0 ? null
|
||||
: VideosFolders.Problem(text.Trim(), _s.LastArchivePath, Shell.Services.Workspace.Root) is { } problem ? VideoText.FolderReason(problem) : null;
|
||||
|
||||
/// <summary>Opens the videos folder in Explorer, creating it first (it is Chronos's own folder for copies).</summary>
|
||||
private void OpenVideosFolder()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_s.VideosFolder)) return;
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(_s.VideosFolder);
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
ShellActions.Reveal(_s.VideosFolder);
|
||||
}
|
||||
|
||||
private void Browse(EditableField field, string titleKey)
|
||||
{
|
||||
var folder = Shell.Services.Dialogs.PickFolder(Loc.L(titleKey), field.Value.Length > 0 ? field.Value : null);
|
||||
@@ -1620,8 +1656,10 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
_s.FileTemplate = defaults.FileTemplate;
|
||||
_s.ProxyLongEdge = defaults.ProxyLongEdge;
|
||||
_s.ThumbnailLongEdge = defaults.ThumbnailLongEdge;
|
||||
_s.VideosFolder = defaults.VideosFolder;
|
||||
FolderTemplate.Load(_s.FolderTemplate);
|
||||
FileTemplate.Load(_s.FileTemplate);
|
||||
VideosFolder.Load(_s.VideosFolder ?? string.Empty);
|
||||
UpdatePreview();
|
||||
Save();
|
||||
OnAllPropertiesChanged();
|
||||
@@ -1682,6 +1720,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
ArchiveRoot.Load(_s.LastArchivePath ?? string.Empty);
|
||||
FolderTemplate.Load(_s.FolderTemplate);
|
||||
FileTemplate.Load(_s.FileTemplate);
|
||||
VideosFolder.Load(_s.VideosFolder ?? string.Empty);
|
||||
LoadImportFields();
|
||||
LoadAnalysisFields();
|
||||
Parallelism.Load(EffectiveParallelism.ToString(CultureInfo.CurrentCulture));
|
||||
@@ -1765,6 +1804,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
ArchiveRoot.Refresh();
|
||||
FolderTemplate.Refresh();
|
||||
FileTemplate.Refresh();
|
||||
VideosFolder.Refresh();
|
||||
SessionGap.Refresh();
|
||||
MinimumFrames.Refresh();
|
||||
// Decimals are written in the language's own way ("6.25", "6,25").
|
||||
|
||||
Reference in new issue
Block a user