From a9c93ff498025cecc1685c57940dcbe09fc16a99 Mon Sep 17 00:00:00 2001
From: Jason Dove <1695733+jasongdove@users.noreply.github.com>
Date: Sun, 25 Jun 2023 09:14:19 -0500
Subject: [PATCH] add custom resolution management (#1326)
* update some dependencies
* add custom resolution management
---
CHANGELOG.md | 4 +-
.../ErsatzTV.Application.csproj.DotSettings | 1 +
ErsatzTV.Application/FFmpegProfiles/Mapper.cs | 8 +-
.../Commands/CreateCustomResolution.cs | 5 +
.../Commands/CreateCustomResolutionHandler.cs | 76 +
.../Commands/DeleteCustomResolution.cs | 5 +
.../Commands/DeleteCustomResolutionHandler.cs | 40 +
.../FFmpegProfileResolutionViewModel.cs | 2 +-
ErsatzTV.Application/Resolutions/Mapper.cs | 2 +-
.../Queries/GetAllResolutionsHandler.cs | 4 +-
ErsatzTV.Core/Domain/Resolution.cs | 1 +
.../Configurations/ResolutionConfiguration.cs | 7 +-
...130236_Add_Resolution_IsCustom.Designer.cs | 4424 +++++++++++++++++
.../20230625130236_Add_Resolution_IsCustom.cs | 29 +
.../Migrations/TvContextModelSnapshot.cs | 5 +
ErsatzTV/ErsatzTV.csproj | 4 +-
ErsatzTV/Pages/ChannelEditor.razor | 2 +-
ErsatzTV/Pages/CollectionEditor.razor | 2 +-
ErsatzTV/Pages/FFmpegEditor.razor | 2 +-
ErsatzTV/Pages/FillerPresetEditor.razor | 2 +-
ErsatzTV/Pages/LocalLibraryEditor.razor | 2 +-
ErsatzTV/Pages/LocalLibraryPathEditor.razor | 2 +-
ErsatzTV/Pages/MultiCollectionEditor.razor | 2 +-
.../PlayoutAlternateSchedulesEditor.razor | 2 +-
ErsatzTV/Pages/PlayoutEditor.razor | 2 +-
ErsatzTV/Pages/ScheduleEditor.razor | 2 +-
ErsatzTV/Pages/ScheduleItemsEditor.razor | 2 +-
ErsatzTV/Pages/Search.razor | 2 +-
ErsatzTV/Pages/Settings.razor | 152 +-
ErsatzTV/Pages/WatermarkEditor.razor | 2 +-
.../Shared/AddCustomResolutionDialog.razor | 51 +
ErsatzTV/Shared/RemoteMediaSourceEditor.razor | 2 +-
...oteMediaSourcePathReplacementsEditor.razor | 2 +-
.../ViewModels/ResolutionEditViewModel.cs | 7 +
ErsatzTV/_Imports.razor | 1 +
35 files changed, 4797 insertions(+), 61 deletions(-)
create mode 100644 ErsatzTV.Application/Resolutions/Commands/CreateCustomResolution.cs
create mode 100644 ErsatzTV.Application/Resolutions/Commands/CreateCustomResolutionHandler.cs
create mode 100644 ErsatzTV.Application/Resolutions/Commands/DeleteCustomResolution.cs
create mode 100644 ErsatzTV.Application/Resolutions/Commands/DeleteCustomResolutionHandler.cs
create mode 100644 ErsatzTV.Infrastructure/Migrations/20230625130236_Add_Resolution_IsCustom.Designer.cs
create mode 100644 ErsatzTV.Infrastructure/Migrations/20230625130236_Add_Resolution_IsCustom.cs
create mode 100644 ErsatzTV/Shared/AddCustomResolutionDialog.razor
create mode 100644 ErsatzTV/ViewModels/ResolutionEditViewModel.cs
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 843082fdc..327a2d9a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
+### Added
+- Add custom resolution management to `Settings` page
+
### Fixed
- Only allow a single instance of ErsatzTV to run
- This fixes some cases where the search index would become unusable
@@ -13,7 +16,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- A minimal UI will indicate when the database and search index are initializing
- The UI will automatically refresh when the initialization processes have completed
-
## [0.8.0-beta] - 2023-06-23
### Added
- Disable playout buttons and show spinning indicator when a playout is being modified (built/extended, or subtitles are being extracted)
diff --git a/ErsatzTV.Application/ErsatzTV.Application.csproj.DotSettings b/ErsatzTV.Application/ErsatzTV.Application.csproj.DotSettings
index fc08ec0b1..0dc000387 100644
--- a/ErsatzTV.Application/ErsatzTV.Application.csproj.DotSettings
+++ b/ErsatzTV.Application/ErsatzTV.Application.csproj.DotSettings
@@ -33,6 +33,7 @@
True
True
True
+ True
True
True
True
diff --git a/ErsatzTV.Application/FFmpegProfiles/Mapper.cs b/ErsatzTV.Application/FFmpegProfiles/Mapper.cs
index 2f8c821e5..0fa1250a0 100644
--- a/ErsatzTV.Application/FFmpegProfiles/Mapper.cs
+++ b/ErsatzTV.Application/FFmpegProfiles/Mapper.cs
@@ -1,5 +1,4 @@
-using ErsatzTV.Application.Resolutions;
-using ErsatzTV.Core.Api.FFmpegProfiles;
+using ErsatzTV.Core.Api.FFmpegProfiles;
using ErsatzTV.Core.Domain;
namespace ErsatzTV.Application.FFmpegProfiles;
@@ -15,7 +14,7 @@ internal static class Mapper
profile.VaapiDriver,
profile.VaapiDevice,
profile.QsvExtraHardwareFrames,
- Project(profile.Resolution),
+ Resolutions.Mapper.ProjectToViewModel(profile.Resolution),
profile.VideoFormat,
profile.BitDepth,
profile.VideoBitrate,
@@ -57,7 +56,4 @@ internal static class Mapper
ffmpegProfile.AudioSampleRate,
ffmpegProfile.NormalizeFramerate,
ffmpegProfile.DeinterlaceVideo);
-
- private static ResolutionViewModel Project(Resolution resolution) =>
- new(resolution.Id, resolution.Name, resolution.Width, resolution.Height);
}
diff --git a/ErsatzTV.Application/Resolutions/Commands/CreateCustomResolution.cs b/ErsatzTV.Application/Resolutions/Commands/CreateCustomResolution.cs
new file mode 100644
index 000000000..ee89ba417
--- /dev/null
+++ b/ErsatzTV.Application/Resolutions/Commands/CreateCustomResolution.cs
@@ -0,0 +1,5 @@
+using ErsatzTV.Core;
+
+namespace ErsatzTV.Application.Resolutions;
+
+public record CreateCustomResolution(int Width, int Height) : IRequest