private async ValueTask UpdateProfile(FFmpegProfileViewModel existing) { var updateFFmpegProfile = new UpdateFFmpegProfile( existing.Id, Name, ThreadCount, Transcode, (int)Resolution, NormalizeResolution, VideoCodec, NormalizeVideoCodec, VideoBitrate, VideoBufferSize, AudioCodec, NormalizeAudioCodec, AudioBitrate, AudioBufferSize, AudioVolume, AudioChannels, AudioSampleRate, NormalizeAudio); await _ffmpegProfileApi.ApiFfmpegProfilesPatchAsync(updateFFmpegProfile); _logger.LogInformation("Successfully synchronized ffmpeg profile {ProfileName}", Name); }
private async Task <Validation <BaseError, FFmpegProfile> > Validate(UpdateFFmpegProfile request) => (await FFmpegProfileMustExist(request), ValidateName(request), ValidateThreadCount(request),
private async Task <FFmpegProfileViewModel> ApplyUpdateRequest(FFmpegProfile p, UpdateFFmpegProfile update) { p.Name = update.Name; p.ThreadCount = update.ThreadCount; p.Transcode = update.Transcode; p.HardwareAcceleration = update.HardwareAcceleration; p.ResolutionId = update.ResolutionId; p.NormalizeResolution = update.NormalizeResolution; p.VideoCodec = update.VideoCodec; p.NormalizeVideoCodec = update.NormalizeVideoCodec; p.VideoBitrate = update.VideoBitrate; p.VideoBufferSize = update.VideoBufferSize; p.AudioCodec = update.AudioCodec; p.NormalizeAudioCodec = update.NormalizeAudioCodec; p.AudioBitrate = update.AudioBitrate; p.AudioBufferSize = update.AudioBufferSize; p.AudioVolume = update.AudioVolume; p.AudioChannels = update.AudioChannels; p.AudioSampleRate = update.AudioSampleRate; p.NormalizeAudio = update.NormalizeAudio; await _ffmpegProfileRepository.Update(p); return(ProjectToViewModel(p)); }
public Task <Either <BaseError, FFmpegProfileViewModel> > Handle( UpdateFFmpegProfile request, CancellationToken cancellationToken) => Validate(request) .MapT(c => ApplyUpdateRequest(c, request)) .Bind(v => v.ToEitherAsync());
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="updateFFmpegProfile"></param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of ApiResponse (FFmpegProfileViewModel)</returns> public async System.Threading.Tasks.Task <ErsatzTV.Api.Sdk.Client.ApiResponse <FFmpegProfileViewModel> > ApiFfmpegProfilesPatchWithHttpInfoAsync(UpdateFFmpegProfile updateFFmpegProfile, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'updateFFmpegProfile' is set if (updateFFmpegProfile == null) { throw new ErsatzTV.Api.Sdk.Client.ApiException(400, "Missing required parameter 'updateFFmpegProfile' when calling FFmpegProfileApi->ApiFfmpegProfilesPatch"); } ErsatzTV.Api.Sdk.Client.RequestOptions localVarRequestOptions = new ErsatzTV.Api.Sdk.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/json-patch+json", "application/json", "text/json", "application/_*+json" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; var localVarContentType = ErsatzTV.Api.Sdk.Client.ClientUtils.SelectHeaderContentType(_contentTypes); if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); } var localVarAccept = ErsatzTV.Api.Sdk.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } localVarRequestOptions.Data = updateFFmpegProfile; // make the HTTP request var localVarResponse = await this.AsynchronousClient.PatchAsync <FFmpegProfileViewModel>("/api/ffmpeg/profiles", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("ApiFfmpegProfilesPatch", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="updateFFmpegProfile"></param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of FFmpegProfileViewModel</returns> public async System.Threading.Tasks.Task <FFmpegProfileViewModel> ApiFfmpegProfilesPatchAsync(UpdateFFmpegProfile updateFFmpegProfile, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { ErsatzTV.Api.Sdk.Client.ApiResponse <FFmpegProfileViewModel> localVarResponse = await ApiFfmpegProfilesPatchWithHttpInfoAsync(updateFFmpegProfile, cancellationToken).ConfigureAwait(false); return(localVarResponse.Data); }
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="updateFFmpegProfile"></param> /// <returns>FFmpegProfileViewModel</returns> public FFmpegProfileViewModel ApiFfmpegProfilesPatch(UpdateFFmpegProfile updateFFmpegProfile) { ErsatzTV.Api.Sdk.Client.ApiResponse <FFmpegProfileViewModel> localVarResponse = ApiFfmpegProfilesPatchWithHttpInfo(updateFFmpegProfile); return(localVarResponse.Data); }