public IEnumerable <Ruleset> GetRuleSets() { return(_rulesRepository.GetAll <Ruleset>() .OrderBy(r => r.Name) .ThenBy(r => r.MajorVersion) .ThenBy(r => r.MinorVersion) .ToList()); }
public ActionResult <List <ManagementRule> > Get() => _rulesRepository.GetAll();
public List <Rules> GetRules(int CountryId) { return(_rulesRepository.GetAll(CountryId).ToList()); }
private void Process() { var subscriptionResult = ytService.GetSubscriptions(); if (subscriptionResult.Status != ActionStatus.Success) { return; } var rules = rulesRepository.GetAll().Data; foreach (var subscription in subscriptionResult.Data) { var uploads = ytService.GetUploads(subscription.Id); if (uploads.Status != ActionStatus.Success) { continue; } var unprocessedVideos = uploads.Data.Where(o => !ytService.IsProcessed(o.Id)).ToList(); foreach (var video in unprocessedVideos) // should only process new videos { Console.WriteLine("Checking video {0}", video.Title); ManagementRule matchedRule = null; foreach (var rule in rules.OrderByDescending(o => o.Priority)) { var success = false; switch (rule.SearchPosition) { case SearchPosition.VideoTitle: success = CheckRuleOnString(video.Title, rule, out matchedRule); break; case SearchPosition.ChannelTitle: success = CheckRuleOnString(subscription.Title, rule, out matchedRule); break; case SearchPosition.All: if (success = CheckRuleOnString(video.Title, rule, out matchedRule)) { break; } success |= CheckRuleOnString(subscription.Title, rule, out matchedRule); break; default: Console.WriteLine("SearchPosition {0} not supported", rule.SearchPosition); continue; } if (success) { break; } } if (matchedRule == null) { Console.WriteLine("No rules found for '{0}'", video.Title); continue; } matchedRule.LastMatch = DateTime.Now; if (!matchedRule.IgnoreVideo) { Console.WriteLine("Moving video '{0}' to '{1}'", video.Title, matchedRule.Target); var addResult = ytService.AddToPlaylist(video.Id, matchedRule.Target); if (addResult.Status != ActionStatus.Success) { Console.WriteLine("{0} {1}", addResult.Status, addResult.Message); continue; } } ytService.SetProcessed(video.Id, matchedRule.Id); } } }
public List <RulesDto> GetRules() { return(rulesRepository.GetAll().Select(BuildRules).ToList()); }