static async Task <ExitCode> Update(TaskCtx <UpdateOption> ctx) { if (ctx.Option.ChannelIds.HasValue()) { ctx.Cfg.App.LimitedToSeedChannels = ctx.Option.ChannelIds.UnJoin('|').ToHashSet(); } var ytStore = ctx.Cfg.YtStore(ctx.Log); var ytUpdater = new YtDataUpdater(ytStore, ctx.Cfg.App, ctx.Option.UpdateType, async() => await ctx.Cfg.App.Snowflake.OpenConnection(), ctx.Log); await ytUpdater.UpdateData(); return(ExitCode.Success); }
static int Fix(FixOption options) { var cfg = Setup.LoadCfg().Result; UpdateCfgFromOptions(cfg, options); using (var log = Setup.CreateCliLogger(cfg.App)) { var ytStore = cfg.YtStore(log); var ytUpdater = new YtDataUpdater(ytStore, cfg.App, log); try { ytUpdater.RefreshMissingVideos().Wait(); } catch (Exception ex) { log.Error("Error Fixing Data: {Error}", ex.Message, ex); return((int)ExitCode.UnknownError); } return((int)ExitCode.Success); } }
static int Update(UpdateOption u) { var cfg = Setup.LoadCfg().Result; UpdateCfgFromOptions(cfg, u); var log = Setup.CreateCliLogger(cfg.App); try { var ytStore = cfg.YtStore(log); var ytUpdater = new YtDataUpdater(ytStore, cfg.App, log); ytUpdater.UpdateData().Wait(); var ytCollect = new YtCollect(ytStore, cfg.DataStore(cfg.App.Storage.AnalysisPath), cfg.App, log); ytCollect.SaveChannelRelationData().Wait(); } catch (Exception ex) { log.Error("Error Updating/Collecting Data: {Error}", ex.Message, ex); return((int)ExitCode.UnknownError); } return((int)ExitCode.Success); }