@page "/ffmpeg" @using ErsatzTV.Application.FFmpegProfiles @using ErsatzTV.Application.FFmpegProfiles.Commands @using ErsatzTV.Application.FFmpegProfiles.Queries @using Unit = LanguageExt.Unit @inject IDialogService Dialog @inject IMediator Mediator @inject ILogger Logger @inject ISnackbar Snackbar FFmpeg Settings @foreach (FFmpegProfileViewModel profile in _ffmpegProfiles) { @profile.Name } Save Settings FFmpeg Profiles Colored settings will be normalized Name Transcode Resolution Video Codec Audio Codec @context.Name @(context.Transcode ? "Yes" : "No") @context.Resolution.Name @context.VideoCodec @context.AudioCodec
Add Profile
@code { private bool _success; private FFmpegSettingsViewModel _ffmpegSettings; private List _ffmpegProfiles; protected override async Task OnParametersSetAsync() { _ffmpegSettings = await Mediator.Send(new GetFFmpegSettings()); _success = File.Exists(_ffmpegSettings.FFmpegPath) && File.Exists(_ffmpegSettings.FFprobePath); await LoadFFmpegProfilesAsync(); } private async Task SaveSettings() { Either result = await Mediator.Send(new UpdateFFmpegSettings(_ffmpegSettings)); result.Match( Left: error => { Snackbar.Add(error.Value, Severity.Error); Logger.LogError("Unexpected error saving FFmpeg settings: {Error}", error.Value); }, Right: _ => Snackbar.Add("Successfully saved FFmpeg settings", Severity.Success)); } private static string ValidatePathExists(string path) => !File.Exists(path) ? "Path does not exist" : null; 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("Delete FFmpeg Profile", parameters, options); DialogResult result = await dialog.Result; if (!result.Cancelled) { await Mediator.Send(new DeleteFFmpegProfile(ffmpegProfile.Id)); await LoadFFmpegProfilesAsync(); } } }