public async Task <IEnumerable <InternalComment> > GetComments(InternalVideo video)
        {
            _logger.Information($"Getting comments for video {video.Name}, ID {video.Id}.");
            var comments = (await _commentsRetriever.GetComments(video)).ToList();

            if (comments.Count == 0)
            {
                _logger.Warning("No comments found for video.");
            }
            else
            {
                _logger.Information($"Got {comments.Count} comments for video.");
            }
            return(comments);
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <InternalComment> > GetComments(InternalVideo video)
        {
            var cachePath = GetCachePath(video);

            if (File.Exists(cachePath))
            {
                var text = await File.ReadAllTextAsync(cachePath);

                return(JsonConvert.DeserializeObject <IEnumerable <InternalComment> >(text));
            }

            var comments = await _commentsRetriever.GetComments(video);

            await File.WriteAllTextAsync(cachePath, JsonConvert.SerializeObject(comments));

            return(comments);
        }
Exemplo n.º 3
0
        public async Task Write(InternalVideo internalVideo)
        {
            var comments = await _commentsRetriever.GetComments(internalVideo);

            await _srtWriter.Write(internalVideo, comments);
        }