private static void DoCreateTasks(Configuration cfg, ILoggerFactory _loggerFactory)
        {
            IS3Client s3Client = serviceProvider.GetService <IS3Client>();

            string dbFile = Path.Combine(cfg.outputPath, TASK_DB_FILE_NAME);

            Log.Information($"Store recognition tasks list into {dbFile}");

            SkTaskDb taskDb = new SkTaskDb(dbFile, Log.Logger);


            RecognitionSpec rSpec = new RecognitionSpec()
            {
                LanguageCode    = cfg.lang,
                ProfanityFilter = true,
                Model           = cfg.model,
                LiteratureText  = cfg.punctuation,
                PartialResults  = false, //возвращать только финальные результаты false
                AudioEncoding   = cfg.audioEncoding,
                SampleRateHertz = cfg.sampleRate
            };

            SkRecognitionClient recognitionClient = new SkRecognitionClient(new Uri("https://stt.api.cloud.yandex.net:443"),
                                                                            cfg.folderId, cfg.iamToken, rSpec, _loggerFactory, taskDb);

            s3Client.ProcessBucket(cfg.bucket, recognitionClient);

            Log.Information($"Found {taskDb.Count} objects");
        }
        public void ProcessBucket(string bucket, SkRecognitionClient recognitionClient)
        {
            ListObjectsV2Request req = new ListObjectsV2Request
            {
                BucketName = bucket,
            };



            try
            {
                ListObjectsV2Response response = null;
                do
                {
                    response = yandexS3.ListObjectsV2Async(req).GetAwaiter().GetResult();

                    if (response.HttpStatusCode != HttpStatusCode.OK)
                    {
                        log.LogError($"HttpRequest error {response.HttpStatusCode}");
                    }

                    var qResponse = response.S3Objects.AsQueryable <S3Object>();
                    var retVal    = from key in qResponse
                                    where key.Key.EndsWith(".wav", StringComparison.InvariantCultureIgnoreCase) || key.Key.EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase)
                                    orderby key.Key
                                    select new SkTaskModel
                    {
                        AudioUrl = yandexS3.GeneratePreSignedURL(bucket, key.Key, DateTime.Now.AddHours(24), null),
                        Path     = key.Key,
                        TaskId   = null
                    };

                    // Set the marker property
                    req.ContinuationToken = response.NextContinuationToken;

                    recognitionClient.CreateRecognitionTask(retVal.ToArray <SkTaskModel>());
                } while (response != null && response.IsTruncated);
            }
            catch (Exception ex)
            {
                log.LogError(ex, "GetObjectList execution error");
            };
        }