public static Filter FilterFromAnimeGroup(HttpContext ctx, SVR_AnimeGroup grp, int uid) { Filter ob = new Filter { name = grp.GroupName, id = grp.AnimeGroupID, url = ConstructFilterIdUrl(ctx, grp.AnimeGroupID), size = -1, viewed = -1 }; foreach (SVR_AnimeSeries ser in grp.GetSeries().Randomize()) { SVR_AniDB_Anime anim = ser.GetAnime(); if (anim != null) { ImageDetails fanart = anim.GetDefaultFanartDetailsNoBlanks(); ImageDetails banner = anim.GetDefaultWideBannerDetailsNoBlanks(); if (fanart != null) { ob.art.fanart.Add(new Art { url = APIHelper.ConstructImageLinkFromTypeAndId(ctx, (int)fanart.ImageType, fanart.ImageID), index = ob.art.fanart.Count }); ob.art.thumb.Add(new Art { url = APIHelper.ConstructImageLinkFromTypeAndId(ctx, (int)fanart.ImageType, fanart.ImageID), index = ob.art.thumb.Count }); } if (banner != null) { ob.art.banner.Add(new Art { url = APIHelper.ConstructImageLinkFromTypeAndId(ctx, (int)banner.ImageType, banner.ImageID), index = ob.art.banner.Count }); } if (ob.art.fanart.Count > 0) { break; } } } return(ob); }
public static Filter FilterFromGroupFilter(HttpContext ctx, SVR_GroupFilter gg, int uid) { Filter ob = new Filter { name = gg.GroupFilterName, id = gg.GroupFilterID, url = ConstructFilterIdUrl(ctx, gg.GroupFilterID) }; if (gg.GroupsIds.ContainsKey(uid)) { HashSet <int> groups = gg.GroupsIds[uid]; if (groups.Count != 0) { ob.size = groups.Count; ob.viewed = 0; foreach (int grp in groups) { SVR_AnimeGroup ag = RepoFactory.AnimeGroup.GetByID(grp); Video v = ag.GetPlexContract(uid); if (v?.Art != null && v.Thumb != null) { ob.art.fanart.Add(new Art { url = ConstructImageLinkFromRest(ctx, v.Art), index = 0 }); ob.art.thumb.Add(new Art { url = ConstructImageLinkFromRest(ctx, v.Thumb), index = 0 }); break; } } } } return(ob); }