public async ValueTask ExecuteAsync(IConsole console)
        {
            try
            {
                Option <FFmpegProfileViewModel> maybeFFmpegProfile = await _ffmpegProfileApi.ApiFfmpegProfilesGetAsync()
                                                                     .Map(list => Optional(list.SingleOrDefault(p => p.Name == Name)));

                await maybeFFmpegProfile.Match(UpdateProfile, AddProfile);
            }
            catch (Exception ex)
            {
                _logger.LogError("Unable to synchronize ffmpeg profile: {Message}", ex.Message);
            }
        }
Example #2
0
        public async ValueTask ExecuteAsync(IConsole console)
        {
            try
            {
                Option <ChannelViewModel> maybeChannel = await _channelsApi.ApiChannelsGetAsync()
                                                         .Map(list => Optional(list.SingleOrDefault(c => c.Number == Number)));

                FFmpegProfileViewModel ffmpegProfile = await _ffmpegProfileApi.ApiFfmpegProfilesGetAsync()
                                                       .Map(
                    list => Optional(list.SingleOrDefault(p => p.Name == FFmpegProfileName))
                    .IfNone(new FFmpegProfileViewModel {
                    Id = 1
                }));

                await maybeChannel.Match(
                    channel => RenameChannel(channel, ffmpegProfile),
                    () => AddChannel(ffmpegProfile));
            }
            catch (Exception ex)
            {
                _logger.LogError("Unable to synchronize channel: {Message}", ex.Message);
            }
        }