Esempio n. 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
                                    });
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public void Apply(ImdbDetails data)
 {
     imdbs[data.Id] = data;
 }