private IEnumerable <dynamic> GroupCore(int page, Func <RutorItem, bool> predicate) { HashSet <string> returnedImdb = new HashSet <string>(); foreach (var group in items.Values.Where(predicate).GroupBy(x => new { x.Year, x.Title }).OrderByDescending(x => x.Max(i => i.Id))) { foreach (var rItem in group) { if (details.ContainsKey(rItem.Id)) { RutorDetails rDetails = details[rItem.Id]; if (rDetails.Imdb != null && imdbs.ContainsKey(rDetails.Imdb)) { ImdbDetails iDetails = imdbs[rDetails.Imdb]; if (iDetails.Image != null && iDetails.Summary != null) { if (returnedImdb.Add(iDetails.Id)) { yield return(new { Year = group.Key.Year, Title = group.Key.Title, Image = iDetails.Image, Summary = iDetails.Summary, Page = page }); } } } } } } }
private static ImdbDetails CreateFromJson(JToken jsonObj) { if (jsonObj == null) { return(null); } var res = new ImdbDetails(); res.Id = jsonObj.Value <string>("Id"); res.Title = jsonObj.Value <string>("Title"); res.TitleDisplay = jsonObj.Value <string>("TitleDisplay"); res.Year = jsonObj.Value <int?>("Year"); res.YearTo = jsonObj.Value <int?>("YearTo"); res.Season = jsonObj.Value <int?>("Season"); res.Episode = jsonObj.Value <int?>("Episode"); return(res); }
public void Apply(ImdbDetails data) { imdbs[data.Id] = data; }