Browse Source

add troubleshoot button to classic schedules

pull/2615/head
Jason Dove 9 months ago
parent
commit
cba910baaa
No known key found for this signature in database
  1. 2
      CHANGELOG.md
  2. 23
      ErsatzTV/Pages/ScheduleItemsEditor.razor
  3. 66
      ErsatzTV/Shared/ScheduleItemsDialog.razor

2
CHANGELOG.md

@ -29,6 +29,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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

23
ErsatzTV/Pages/ScheduleItemsEditor.razor

@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
@using ErsatzTV.Core.Scheduling
@implements IDisposable
@inject NavigationManager NavigationManager
@inject IDialogService Dialog
@inject ILogger<ScheduleItemsEditor> Logger
@inject ISnackbar Snackbar
@inject IMediator Mediator
@ -57,12 +58,16 @@ @@ -57,12 +58,16 @@
<MudButton Class="ml-3" Variant="Variant.Filled" Color="Color.Default" OnClick="@AddScheduleItem" StartIcon="@Icons.Material.Filled.PlaylistAdd" Disabled="@(_schedule?.Items is null)">
Add Schedule Item
</MudButton>
<MudButton Class="ml-3" Variant="Variant.Filled" Color="Color.Default" OnClick="@Troubleshoot" StartIcon="@Icons.Material.Filled.Info" Disabled="@(_schedule?.Items is null)">
Troubleshoot
</MudButton>
</div>
<div style="align-items: center; display: flex; margin-left: auto;" class="d-md-none">
<div class="flex-grow-1"></div>
<MudMenu Icon="@Icons.Material.Filled.MoreVert">
<MudMenuItem Icon="@Icons.Material.Filled.Save" Label="Save Schedule Items" OnClick="@SaveChanges"/>
<MudMenuItem Icon="@Icons.Material.Filled.PlaylistAdd" Label="Add Schedule Item" OnClick="@AddScheduleItem"/>
<MudMenuItem Icon="@Icons.Material.Filled.Info" Label="Troubleshoot" OnClick="@Troubleshoot"/>
</MudMenu>
</div>
</div>
@ -966,6 +971,23 @@ @@ -966,6 +971,23 @@
return result;
}
private async Task Troubleshoot()
{
Option<ProgramScheduleViewModel> maybeSchedule = await Mediator.Send(new GetProgramScheduleById(Id), _cts.Token);
Option<IEnumerable<ProgramScheduleItemViewModel>> maybeResults = await Mediator.Send(new GetProgramScheduleItems(Id), _cts.Token);
foreach (ProgramScheduleViewModel schedule in maybeSchedule)
{
foreach (IEnumerable<ProgramScheduleItemViewModel> 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<ScheduleItemsDialog>(_schedule.Name, parameters, options);
DialogResult _ = await dialog.Result;
}
}
}
private void AddScheduleItem()
{
var item = new ProgramScheduleItemEditViewModel
@ -1134,5 +1156,4 @@ @@ -1134,5 +1156,4 @@
}
private string SelectedRowClassFunc(ProgramScheduleItemEditViewModel element, int rowNumber) => _selectedItem != null && _selectedItem == element ? "selected" : string.Empty;
}

66
ErsatzTV/Shared/ScheduleItemsDialog.razor

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
@using System.Text.Json
@using System.Text.Json.Serialization
@using ErsatzTV.Application.ProgramSchedules
@inject IJSRuntime JsRuntime
<div>
<MudDialog>
<DialogContent>
<div class="overflow-y-scroll" style="max-height: 500px">
<pre>
<code @ref="_infoView">@_info</code>
</pre>
</div>
</DialogContent>
<DialogActions>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(() => CopyToClipboard(_infoView))">
Copy
</MudButton>
<MudButton Color="Color.Primary" OnClick="@Close">Close</MudButton>
</DialogActions>
</MudDialog>
</div>
@code {
[CascadingParameter]
IMudDialogInstance MudDialog { get; set; }
[Parameter]
public ProgramScheduleViewModel Schedule { get; set; }
[Parameter]
public IEnumerable<ProgramScheduleItemViewModel> 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));
}
Loading…
Cancel
Save