|
|
|
@ -6,6 +6,7 @@ |
|
|
|
@using ErsatzTV.Application.Watermarks |
|
|
|
@using ErsatzTV.Application.Watermarks |
|
|
|
@using System.Globalization |
|
|
|
@using System.Globalization |
|
|
|
@using ErsatzTV.Application.Configuration |
|
|
|
@using ErsatzTV.Application.Configuration |
|
|
|
|
|
|
|
@using Serilog.Events |
|
|
|
@using ErsatzTV.Core.Domain.Filler |
|
|
|
@using ErsatzTV.Core.Domain.Filler |
|
|
|
@implements IDisposable |
|
|
|
@implements IDisposable |
|
|
|
@inject IMediator _mediator |
|
|
|
@inject IMediator _mediator |
|
|
|
@ -13,7 +14,7 @@ |
|
|
|
@inject ILogger<Settings> _logger |
|
|
|
@inject ILogger<Settings> _logger |
|
|
|
|
|
|
|
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8" Style="display: flex; flex-direction: row"> |
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8" Style="display: flex; flex-direction: row"> |
|
|
|
<div style="display: flex; flex-direction: row; flex-wrap: wrap"> |
|
|
|
<MudGrid> |
|
|
|
<MudCard Class="mr-6 mb-6" Style="max-width: 400px"> |
|
|
|
<MudCard Class="mr-6 mb-6" Style="max-width: 400px"> |
|
|
|
<MudCardHeader> |
|
|
|
<MudCardHeader> |
|
|
|
<CardHeaderContent> |
|
|
|
<CardHeaderContent> |
|
|
|
@ -100,73 +101,98 @@ |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_success)" OnClick="@(_ => SaveFFmpegSettings())">Save Settings</MudButton> |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_success)" OnClick="@(_ => SaveFFmpegSettings())">Save Settings</MudButton> |
|
|
|
</MudCardActions> |
|
|
|
</MudCardActions> |
|
|
|
</MudCard> |
|
|
|
</MudCard> |
|
|
|
<MudCard Class="mr-6 mb-auto" Style="width: 350px"> |
|
|
|
<MudStack Class="mr-6"> |
|
|
|
<MudCardHeader> |
|
|
|
<MudCard Class="mb-6" Style="width: 350px"> |
|
|
|
<CardHeaderContent> |
|
|
|
<MudCardHeader> |
|
|
|
<MudText Typo="Typo.h6">HDHomeRun Settings</MudText> |
|
|
|
<CardHeaderContent> |
|
|
|
</CardHeaderContent> |
|
|
|
<MudText Typo="Typo.h6">General Settings</MudText> |
|
|
|
</MudCardHeader> |
|
|
|
</CardHeaderContent> |
|
|
|
<MudCardContent> |
|
|
|
</MudCardHeader> |
|
|
|
<MudForm @bind-IsValid="@_hdhrSuccess"> |
|
|
|
<MudCardContent> |
|
|
|
<MudTextField T="int" Label="Tuner Count" @bind-Value="_tunerCount" Validation="@(new Func<int, string>(ValidateTunerCount))" Required="true" RequiredError="Tuner count is required!"/> |
|
|
|
<MudForm> |
|
|
|
</MudForm> |
|
|
|
<MudSelect Class="mt-3" |
|
|
|
</MudCardContent> |
|
|
|
Label="Minimum Log Level" |
|
|
|
<MudCardActions> |
|
|
|
@bind-Value="_generalSettings.MinimumLogLevel" |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_hdhrSuccess)" OnClick="@(_ => SaveHDHRSettings())">Save Settings</MudButton> |
|
|
|
For="@(() => _generalSettings.MinimumLogLevel)"> |
|
|
|
</MudCardActions> |
|
|
|
<MudSelectItem Value="@LogEventLevel.Debug">Debug</MudSelectItem> |
|
|
|
</MudCard> |
|
|
|
<MudSelectItem Value="@LogEventLevel.Information">Information</MudSelectItem> |
|
|
|
<MudCard Class="mr-6" Style="width: 350px"> |
|
|
|
<MudSelectItem Value="@LogEventLevel.Warning">Warning</MudSelectItem> |
|
|
|
<MudCardHeader> |
|
|
|
<MudSelectItem Value="@LogEventLevel.Error">Error</MudSelectItem> |
|
|
|
<CardHeaderContent> |
|
|
|
</MudSelect> |
|
|
|
<MudText Typo="Typo.h6">Scanner Settings</MudText> |
|
|
|
</MudForm> |
|
|
|
</CardHeaderContent> |
|
|
|
</MudCardContent> |
|
|
|
</MudCardHeader> |
|
|
|
<MudCardActions> |
|
|
|
<MudCardContent> |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(_ => SaveGeneralSettings())">Save Settings</MudButton> |
|
|
|
<MudForm @bind-IsValid="@_scannerSuccess"> |
|
|
|
</MudCardActions> |
|
|
|
<MudTextField T="int" |
|
|
|
</MudCard> |
|
|
|
Label="Library Refresh Interval" |
|
|
|
<MudCard Class="mb-6" Style="width: 350px"> |
|
|
|
@bind-Value="_libraryRefreshInterval" |
|
|
|
<MudCardHeader> |
|
|
|
Validation="@(new Func<int, string>(ValidateLibraryRefreshInterval))" |
|
|
|
<CardHeaderContent> |
|
|
|
Required="true" |
|
|
|
<MudText Typo="Typo.h6">HDHomeRun Settings</MudText> |
|
|
|
RequiredError="Library refresh interval is required!" |
|
|
|
</CardHeaderContent> |
|
|
|
Adornment="Adornment.End" |
|
|
|
</MudCardHeader> |
|
|
|
AdornmentText="Hours"/> |
|
|
|
<MudCardContent> |
|
|
|
</MudForm> |
|
|
|
<MudForm @bind-IsValid="@_hdhrSuccess"> |
|
|
|
</MudCardContent> |
|
|
|
<MudTextField T="int" Label="Tuner Count" @bind-Value="_tunerCount" Validation="@(new Func<int, string>(ValidateTunerCount))" Required="true" RequiredError="Tuner count is required!"/> |
|
|
|
<MudCardActions> |
|
|
|
</MudForm> |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_scannerSuccess)" OnClick="@(_ => SaveScannerSettings())">Save Settings</MudButton> |
|
|
|
</MudCardContent> |
|
|
|
</MudCardActions> |
|
|
|
<MudCardActions> |
|
|
|
</MudCard> |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_hdhrSuccess)" OnClick="@(_ => SaveHDHRSettings())">Save Settings</MudButton> |
|
|
|
<MudCard Style="width: 350px"> |
|
|
|
</MudCardActions> |
|
|
|
<MudCardHeader> |
|
|
|
</MudCard> |
|
|
|
<CardHeaderContent> |
|
|
|
<MudCard Class="mb-6" Style="width: 350px"> |
|
|
|
<MudText Typo="Typo.h6">Playout Settings</MudText> |
|
|
|
<MudCardHeader> |
|
|
|
</CardHeaderContent> |
|
|
|
<CardHeaderContent> |
|
|
|
</MudCardHeader> |
|
|
|
<MudText Typo="Typo.h6">Scanner Settings</MudText> |
|
|
|
<MudCardContent> |
|
|
|
</CardHeaderContent> |
|
|
|
<MudForm @bind-IsValid="@_playoutSuccess"> |
|
|
|
</MudCardHeader> |
|
|
|
<MudTextField T="int" |
|
|
|
<MudCardContent> |
|
|
|
Label="Days To Build" |
|
|
|
<MudForm @bind-IsValid="@_scannerSuccess"> |
|
|
|
@bind-Value="_playoutSettings.DaysToBuild" |
|
|
|
<MudTextField T="int" |
|
|
|
Validation="@(new Func<int, string>(ValidatePlayoutDaysToBuild))" |
|
|
|
Label="Library Refresh Interval" |
|
|
|
Required="true" |
|
|
|
@bind-Value="_libraryRefreshInterval" |
|
|
|
RequiredError="Days to build is required!" |
|
|
|
Validation="@(new Func<int, string>(ValidateLibraryRefreshInterval))" |
|
|
|
Adornment="Adornment.End" |
|
|
|
Required="true" |
|
|
|
AdornmentText="Days"/> |
|
|
|
RequiredError="Library refresh interval is required!" |
|
|
|
<MudElement HtmlTag="div" Class="mt-3"> |
|
|
|
Adornment="Adornment.End" |
|
|
|
<MudTooltip Text="Controls whether file-not-found or unavailable items should be included in playouts"> |
|
|
|
AdornmentText="Hours"/> |
|
|
|
<MudCheckBox Label="Skip Missing Items" |
|
|
|
</MudForm> |
|
|
|
@bind-Checked="_playoutSettings.SkipMissingItems" |
|
|
|
</MudCardContent> |
|
|
|
For="@(() => _playoutSettings.SkipMissingItems)"/> |
|
|
|
<MudCardActions> |
|
|
|
</MudTooltip> |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_scannerSuccess)" OnClick="@(_ => SaveScannerSettings())">Save Settings</MudButton> |
|
|
|
</MudElement> |
|
|
|
</MudCardActions> |
|
|
|
</MudForm> |
|
|
|
</MudCard> |
|
|
|
</MudCardContent> |
|
|
|
<MudCard Class="mb-6" Style="width: 350px"> |
|
|
|
<MudCardActions> |
|
|
|
<MudCardHeader> |
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_playoutSuccess)" OnClick="@(_ => SavePlayoutSettings())">Save Settings</MudButton> |
|
|
|
<CardHeaderContent> |
|
|
|
</MudCardActions> |
|
|
|
<MudText Typo="Typo.h6">Playout Settings</MudText> |
|
|
|
</MudCard> |
|
|
|
</CardHeaderContent> |
|
|
|
</div> |
|
|
|
</MudCardHeader> |
|
|
|
|
|
|
|
<MudCardContent> |
|
|
|
|
|
|
|
<MudForm @bind-IsValid="@_playoutSuccess"> |
|
|
|
|
|
|
|
<MudTextField T="int" |
|
|
|
|
|
|
|
Label="Days To Build" |
|
|
|
|
|
|
|
@bind-Value="_playoutSettings.DaysToBuild" |
|
|
|
|
|
|
|
Validation="@(new Func<int, string>(ValidatePlayoutDaysToBuild))" |
|
|
|
|
|
|
|
Required="true" |
|
|
|
|
|
|
|
RequiredError="Days to build is required!" |
|
|
|
|
|
|
|
Adornment="Adornment.End" |
|
|
|
|
|
|
|
AdornmentText="Days"/> |
|
|
|
|
|
|
|
<MudElement HtmlTag="div" Class="mt-3"> |
|
|
|
|
|
|
|
<MudTooltip Text="Controls whether file-not-found or unavailable items should be included in playouts"> |
|
|
|
|
|
|
|
<MudCheckBox Label="Skip Missing Items" |
|
|
|
|
|
|
|
@bind-Checked="_playoutSettings.SkipMissingItems" |
|
|
|
|
|
|
|
For="@(() => _playoutSettings.SkipMissingItems)"/> |
|
|
|
|
|
|
|
</MudTooltip> |
|
|
|
|
|
|
|
</MudElement> |
|
|
|
|
|
|
|
</MudForm> |
|
|
|
|
|
|
|
</MudCardContent> |
|
|
|
|
|
|
|
<MudCardActions> |
|
|
|
|
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Disabled="@(!_playoutSuccess)" OnClick="@(_ => SavePlayoutSettings())">Save Settings</MudButton> |
|
|
|
|
|
|
|
</MudCardActions> |
|
|
|
|
|
|
|
</MudCard> |
|
|
|
|
|
|
|
</MudStack> |
|
|
|
|
|
|
|
</MudGrid> |
|
|
|
</MudContainer> |
|
|
|
</MudContainer> |
|
|
|
|
|
|
|
|
|
|
|
@code { |
|
|
|
@code { |
|
|
|
@ -184,6 +210,7 @@ |
|
|
|
private int _tunerCount; |
|
|
|
private int _tunerCount; |
|
|
|
private int _libraryRefreshInterval; |
|
|
|
private int _libraryRefreshInterval; |
|
|
|
private PlayoutSettingsViewModel _playoutSettings; |
|
|
|
private PlayoutSettingsViewModel _playoutSettings; |
|
|
|
|
|
|
|
private GeneralSettingsViewModel _generalSettings; |
|
|
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -207,6 +234,7 @@ |
|
|
|
_scannerSuccess = _libraryRefreshInterval > 0; |
|
|
|
_scannerSuccess = _libraryRefreshInterval > 0; |
|
|
|
_playoutSettings = await _mediator.Send(new GetPlayoutSettings(), _cts.Token); |
|
|
|
_playoutSettings = await _mediator.Send(new GetPlayoutSettings(), _cts.Token); |
|
|
|
_playoutSuccess = _playoutSettings.DaysToBuild > 0; |
|
|
|
_playoutSuccess = _playoutSettings.DaysToBuild > 0; |
|
|
|
|
|
|
|
_generalSettings = await _mediator.Send(new GetGeneralSettings(), _cts.Token); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static string ValidatePathExists(string path) => !File.Exists(path) ? "Path does not exist" : null; |
|
|
|
private static string ValidatePathExists(string path) => !File.Exists(path) ? "Path does not exist" : null; |
|
|
|
@ -274,4 +302,16 @@ |
|
|
|
Right: _ => _snackbar.Add("Successfully saved playout settings", Severity.Success)); |
|
|
|
Right: _ => _snackbar.Add("Successfully saved playout settings", Severity.Success)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task SaveGeneralSettings() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Either<BaseError, Unit> result = await _mediator.Send(new UpdateGeneralSettings(_generalSettings), _cts.Token); |
|
|
|
|
|
|
|
result.Match( |
|
|
|
|
|
|
|
Left: error => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_snackbar.Add(error.Value, Severity.Error); |
|
|
|
|
|
|
|
_logger.LogError("Unexpected error saving general settings: {Error}", error.Value); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
Right: _ => _snackbar.Add("Successfully saved general settings", Severity.Success)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |