public UpdateVersionService() { // Fetch the build channel attribute the program was compiled with System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly(); buildVersion = assemblyInfo.GetName().Version; var buildChannelVersion = assemblyInfo.GetCustomAttributes(typeof(BuildChannelAttribute), false).FirstOrDefault(item => item is BuildChannelAttribute) as BuildChannelAttribute ?? new BuildChannelAttribute("", UpdateChannelType.Stable); // Check if the update channel has been overridden by the user //if (SettingsManager.Settings.HasSetting("updateChannel")) //{ // UpdateChannelType updateChannel; // if (Enum.TryParse<UpdateChannelType>(SettingsManager.Settings.Read("updateChannel") as string, out updateChannel)) // UpdateChannel = updateChannel; //} //else //{ updateChannel = buildChannelVersion.UpdateChannel; //} }
async Task <(ChannelStored2 c, UpdateChannelType update)> UpdateChannelDetail(ChannelStored2 channel, UpdateChannelType update, ILogger log) { var channelLog = log.ForContext("Channel", channel.ChannelId).ForContext("ChannelId", channel.ChannelId); var full = update == Full; var c = channel.JsonClone(); try { c.Updated = DateTime.Now; var d = await Api.ChannelData(c.ChannelId, full); // to save quota - full update only when missing features channels if (d != null) { c.ChannelTitle = d.Title; c.Description = d.Description; c.LogoUrl = d.Thumbnails?.Default__?.Url; c.Subs = d.Stats?.SubCount; c.ChannelViews = d.Stats?.ViewCount; c.Country = d.Country; c.FeaturedChannelIds = d.FeaturedChannelIds ?? c.FeaturedChannelIds; c.Keywords = d.Keywords ?? c.Keywords; c.Subscriptions = d.Subscriptions ?? c.Subscriptions; c.DefaultLanguage = d.DefaultLanguage ?? c.DefaultLanguage; c.Status = ChannelStatus.Alive; if (full) { c.LastFullUpdate = c.Updated; } } else { c.Status = ChannelStatus.Dead; } channelLog.Information("Collect - {Channel} - channel details ({Update})", c.ChannelTitle, update.EnumString()); } catch (Exception ex) { channelLog.Error(ex, "Collect - {Channel} - Error when updating details for channel : {Error}", c.ChannelTitle, ex.Message); } return(c, update); }
public void RemoveLazyUpdate(ILazyUpdate lazyUpdate, UpdateChannelType fromChannel) { int index = (int)fromChannel; _updateChannels[index].UpdateList.Remove(lazyUpdate); }
public void AddLazyUpdate(ILazyUpdate lazyUpdate, UpdateChannelType toChannel) { int index = (int)toChannel; _updateChannels[index].UpdateList.Add(lazyUpdate); }
public ChannelUpdatePlan(ChannelStored2 channel, UpdateChannelType update = Standard, DateTime?videosFrom = null) { Channel = channel; Update = update; VideosFrom = videosFrom; }
public BuildChannelAttribute(string displayName, UpdateChannelType channelType) { DisplayName = displayName; UpdateChannel = channelType; }