diff --git a/CHANGELOG.md b/CHANGELOG.md index afe5d7722..b96e77e2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - There are two requirements for AviSynth Scripts to work: - FFmpeg needs to be compiled with AviSynth support (not currently available in Docker) - AviSynth itself needs to be installed +- Add `Troubleshoot` button to classic schedule items editor + - This generates JSON representing the entire schedule which can easily be shared when requested for troubleshooting ### Fixed - Fix HLS Direct playback with Jellyfin 10.11 diff --git a/ErsatzTV/Pages/ScheduleItemsEditor.razor b/ErsatzTV/Pages/ScheduleItemsEditor.razor index 1b21f096e..6df424361 100644 --- a/ErsatzTV/Pages/ScheduleItemsEditor.razor +++ b/ErsatzTV/Pages/ScheduleItemsEditor.razor @@ -10,6 +10,7 @@ @using ErsatzTV.Core.Scheduling @implements IDisposable @inject NavigationManager NavigationManager +@inject IDialogService Dialog @inject ILogger Logger @inject ISnackbar Snackbar @inject IMediator Mediator @@ -57,12 +58,16 @@ Add Schedule Item + + Troubleshoot +
+
@@ -966,6 +971,23 @@ return result; } + private async Task Troubleshoot() + { + Option maybeSchedule = await Mediator.Send(new GetProgramScheduleById(Id), _cts.Token); + Option> maybeResults = await Mediator.Send(new GetProgramScheduleItems(Id), _cts.Token); + + foreach (ProgramScheduleViewModel schedule in maybeSchedule) + { + foreach (IEnumerable results in maybeResults) + { + var parameters = new DialogParameters { { "Schedule", schedule }, { "Items", results } }; + var options = new DialogOptions { CloseButton = true, CloseOnEscapeKey = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; + IDialogReference dialog = await Dialog.ShowAsync(_schedule.Name, parameters, options); + DialogResult _ = await dialog.Result; + } + } + } + private void AddScheduleItem() { var item = new ProgramScheduleItemEditViewModel @@ -1134,5 +1156,4 @@ } private string SelectedRowClassFunc(ProgramScheduleItemEditViewModel element, int rowNumber) => _selectedItem != null && _selectedItem == element ? "selected" : string.Empty; - } diff --git a/ErsatzTV/Shared/ScheduleItemsDialog.razor b/ErsatzTV/Shared/ScheduleItemsDialog.razor new file mode 100644 index 000000000..e897a400a --- /dev/null +++ b/ErsatzTV/Shared/ScheduleItemsDialog.razor @@ -0,0 +1,66 @@ +@using System.Text.Json +@using System.Text.Json.Serialization +@using ErsatzTV.Application.ProgramSchedules +@inject IJSRuntime JsRuntime + +
+ + +
+
+                    @_info
+                
+
+
+ + + Copy + + Close + +
+
+ +@code { + + [CascadingParameter] + IMudDialogInstance MudDialog { get; set; } + + [Parameter] + public ProgramScheduleViewModel Schedule { get; set; } + + [Parameter] + public IEnumerable Items { get; set; } + + private string _info; + private ElementReference _infoView; + + protected override Task OnParametersSetAsync() + { + try + { + _info = JsonSerializer.Serialize( + new + { + Schedule, + Items + }, + new JsonSerializerOptions + { + Converters = { new JsonStringEnumConverter() }, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + } + catch (Exception ex) + { + _info = ex.ToString(); + } + + return Task.CompletedTask; + } + + private async Task CopyToClipboard(ElementReference view) => await JsRuntime.InvokeVoidAsync("clipboardCopy.copyText", view); + + private void Close() => MudDialog.Close(DialogResult.Ok(true)); +}