Ejemplo n.º 1
0
        public async Task SaveCaptions()
        {
            var cfg = await Setup.LoadCfg();

            var log = Setup.CreateTestLogger();

            var videoIds = new[] { "P0dcyAXXmCw" };
            var store    = new YtStore(new YtClient(cfg.App, log), cfg.DataStore());

            foreach (var videoId in videoIds)
            {
                var txt = await store.GetAndUpdateVideoCaptions(videoId);
            }
        }
Ejemplo n.º 2
0
        public async Task SaveCaptions()
        {
            var cfg = await Setup.LoadCfg();

            var log = Setup.CreateTestLogger();

            var store      = new YtStore(new YtClient(cfg.App, log), cfg.DataStore());
            var channelCfg = await cfg.App.LoadChannelConfig();

            foreach (var c in channelCfg.Seeds.Randomize())
            {
                var existingCaptionIds = (await store.Store.List(StringPath.Relative("VideoCaptions", c.Id)))
                                         .Select(b => b.NameSansExtension).ToHashSet();
                if (existingCaptionIds.Any())
                {
                    continue;
                }
                var cvc = await store.ChannelVideosCollection.Get(c.Id);

                var toUpdate = cvc.Vids.OrderByDescending(v => v.PublishedAt).Take(50)
                               .Where(v => !existingCaptionIds.Contains(v.VideoId)).ToList();
                await toUpdate.BlockAction(v => store.GetAndUpdateVideoCaptions(c.Id, v.VideoId, log), cfg.App.ParallelCollect);
            }
        }