115 lines
4.7 KiB
Plaintext
115 lines
4.7 KiB
Plaintext
@page "/ffmpeg"
|
|
@using ErsatzTV.Application.FFmpegProfiles
|
|
@using ErsatzTV.Application.FFmpegProfiles.Commands
|
|
@using ErsatzTV.Application.FFmpegProfiles.Queries
|
|
@inject IDialogService _dialog
|
|
@inject IMediator _mediator
|
|
@inject ILogger<FFmpeg> _logger
|
|
@inject ISnackbar _snackbar
|
|
@inject NavigationManager _navigationManager
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8">
|
|
<MudTable Hover="true" Items="_ffmpegProfiles">
|
|
<ToolBarContent>
|
|
<MudText Typo="Typo.h6">FFmpeg Profiles</MudText>
|
|
<MudSpacer/>
|
|
<MudText Color="Color.Tertiary">Colored settings will be normalized</MudText>
|
|
</ToolBarContent>
|
|
<ColGroup>
|
|
<col/>
|
|
<col/>
|
|
<col/>
|
|
<col/>
|
|
<col/>
|
|
<col style="width: 180px;"/>
|
|
</ColGroup>
|
|
<HeaderContent>
|
|
<MudTh>Name</MudTh>
|
|
<MudTh>Transcode</MudTh>
|
|
<MudTh>Resolution</MudTh>
|
|
<MudTh>Video Codec</MudTh>
|
|
<MudTh>Audio Codec</MudTh>
|
|
<MudTh/>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
<MudTd DataLabel="Name">@context.Name</MudTd>
|
|
<MudTd DataLabel="Transcode">
|
|
@(context.Transcode ? "Yes" : "No")
|
|
</MudTd>
|
|
<MudTd DataLabel="Resolution">
|
|
<MudText Color="@(context.Transcode && context.NormalizeVideo ? Color.Tertiary : Color.Inherit)">
|
|
@context.Resolution.Name
|
|
</MudText>
|
|
</MudTd>
|
|
<MudTd DataLabel="Video Codec">
|
|
<MudText Color="@(context.Transcode && context.NormalizeVideo ? Color.Tertiary : Color.Inherit)">
|
|
@context.VideoCodec
|
|
</MudText>
|
|
</MudTd>
|
|
<MudTd DataLabel="Audio Codec">
|
|
<MudText Color="@(context.Transcode && context.NormalizeAudio ? Color.Tertiary : Color.Inherit)">
|
|
@context.AudioCodec
|
|
</MudText>
|
|
</MudTd>
|
|
<MudTd>
|
|
<div style="align-items: center; display: flex;">
|
|
<MudTooltip Text="Edit Profile">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit"
|
|
Link="@($"/ffmpeg/{context.Id}")">
|
|
</MudIconButton>
|
|
</MudTooltip>
|
|
<MudTooltip Text="Copy Profile">
|
|
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy"
|
|
OnClick="@(_ => CopyProfileAsync(context))">
|
|
</MudIconButton>
|
|
</MudTooltip>
|
|
<MudTooltip Text="Delete Profile">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
|
OnClick="@(_ => DeleteProfileAsync(context))">
|
|
</MudIconButton>
|
|
</MudTooltip>
|
|
</div>
|
|
</MudTd>
|
|
</RowTemplate>
|
|
</MudTable>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Link="/ffmpeg/add" Class="mt-4">
|
|
Add Profile
|
|
</MudButton>
|
|
</MudContainer>
|
|
|
|
@code {
|
|
private List<FFmpegProfileViewModel> _ffmpegProfiles;
|
|
|
|
protected override async Task OnParametersSetAsync() => await LoadFFmpegProfilesAsync();
|
|
|
|
private async Task LoadFFmpegProfilesAsync() =>
|
|
_ffmpegProfiles = await _mediator.Send(new GetAllFFmpegProfiles());
|
|
|
|
private async Task DeleteProfileAsync(FFmpegProfileViewModel ffmpegProfile)
|
|
{
|
|
var parameters = new DialogParameters { { "EntityType", "ffmpeg profile" }, { "EntityName", ffmpegProfile.Name } };
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
|
|
|
|
IDialogReference dialog = _dialog.Show<DeleteDialog>("Delete FFmpeg Profile", parameters, options);
|
|
DialogResult result = await dialog.Result;
|
|
if (!result.Cancelled)
|
|
{
|
|
await _mediator.Send(new DeleteFFmpegProfile(ffmpegProfile.Id));
|
|
await LoadFFmpegProfilesAsync();
|
|
}
|
|
}
|
|
|
|
private async Task CopyProfileAsync(FFmpegProfileViewModel ffmpegProfile)
|
|
{
|
|
var parameters = new DialogParameters { { "FFmpegProfileId", ffmpegProfile.Id } };
|
|
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
|
|
|
|
IDialogReference dialog = _dialog.Show<CopyFFmpegProfileDialog>("Copy FFmpeg Profile", parameters, options);
|
|
DialogResult dialogResult = await dialog.Result;
|
|
if (!dialogResult.Cancelled && dialogResult.Data is FFmpegProfileViewModel data)
|
|
{
|
|
_navigationManager.NavigateTo($"/ffmpeg/{data.Id}");
|
|
}
|
|
}
|
|
|
|
} |