Пример #1
0
        private async Task UpsertVideo(Func <IData, InsertStatus, CancellationToken, Task> callback, VideoData video, CancellationToken cancellationToken)
        {
            var context = _youTubeCleanupToolDbContextFactory.Create();
            var result  = await context.UpsertVideo(video);

            await callback(video, result, cancellationToken);

            await context.SaveChangesAsync(cancellationToken);
        }
Пример #2
0
 private async Task <byte[]> GetThumbnail(CancellationToken cancellationToken, VideoData video)
 {
     try
     {
         return(await _httpClientWrapper.GetByteArrayAsync(video.ThumbnailUrl, cancellationToken));
     }
     catch (Exception ex)
     {
         _logger.Debug($"Video {video.DisplayInfo()} has no thumbnail, or we errored - Error: {ex}");
         return(new byte[0]);
     }
 }