Example #1
0
        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
                                    });
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
 public void Apply(string id, RutorDetails data)
 {
     if (data == RutorDetails.Removed)
     {
         details.Remove(id);
         items.Remove(id);
     }
     else
     {
         details[data.Id] = data;
     }
 }