private async ValueTask AddProfile()
        {
            var createFFmpegProfile = new CreateFFmpegProfile(
                Name,
                ThreadCount,
                Transcode,
                (int)Resolution,
                NormalizeResolution,
                VideoCodec,
                NormalizeVideoCodec,
                VideoBitrate,
                VideoBufferSize,
                AudioCodec,
                NormalizeAudioCodec,
                AudioBitrate,
                AudioBufferSize,
                AudioVolume,
                AudioChannels,
                AudioSampleRate,
                NormalizeAudio);


            await _ffmpegProfileApi.ApiFfmpegProfilesPostAsync(createFFmpegProfile);

            _logger.LogInformation("Successfully created ffmpeg profile {ProfileName}", Name);
        }
 private async Task <Validation <BaseError, FFmpegProfile> > Validate(CreateFFmpegProfile request) =>
 (ValidateName(request), ValidateThreadCount(request), await ResolutionMustExist(request))
 public Task <Either <BaseError, FFmpegProfileViewModel> > Handle(
     CreateFFmpegProfile request,
     CancellationToken cancellationToken) =>
 Validate(request)
 .MapT(PersistFFmpegProfile)
 .Bind(v => v.ToEitherAsync());
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="createFFmpegProfile"></param>
        /// <returns>ApiResponse of FFmpegProfileViewModel</returns>
        public ErsatzTV.Api.Sdk.Client.ApiResponse <FFmpegProfileViewModel> ApiFfmpegProfilesPostWithHttpInfo(CreateFFmpegProfile createFFmpegProfile)
        {
            // verify the required parameter 'createFFmpegProfile' is set
            if (createFFmpegProfile == null)
            {
                throw new ErsatzTV.Api.Sdk.Client.ApiException(400, "Missing required parameter 'createFFmpegProfile' when calling FFmpegProfileApi->ApiFfmpegProfilesPost");
            }

            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 = createFFmpegProfile;


            // make the HTTP request
            var localVarResponse = this.Client.Post <FFmpegProfileViewModel>("/api/ffmpeg/profiles", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("ApiFfmpegProfilesPost", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="createFFmpegProfile"></param>
 /// <returns>FFmpegProfileViewModel</returns>
 public FFmpegProfileViewModel ApiFfmpegProfilesPost(CreateFFmpegProfile createFFmpegProfile)
 {
     ErsatzTV.Api.Sdk.Client.ApiResponse <FFmpegProfileViewModel> localVarResponse = ApiFfmpegProfilesPostWithHttpInfo(createFFmpegProfile);
     return(localVarResponse.Data);
 }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="createFFmpegProfile"></param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of FFmpegProfileViewModel</returns>
        public async System.Threading.Tasks.Task <FFmpegProfileViewModel> ApiFfmpegProfilesPostAsync(CreateFFmpegProfile createFFmpegProfile, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            ErsatzTV.Api.Sdk.Client.ApiResponse <FFmpegProfileViewModel> localVarResponse = await ApiFfmpegProfilesPostWithHttpInfoAsync(createFFmpegProfile, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }