public static Filter FilterFromAnimeGroup(HttpContext ctx, SVR_AnimeGroup grp, int uid) { Filter ob = new Filter { name = grp.GroupName, id = grp.AnimeGroupID, url = APIHelper.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 string GetRandomBannerFromSeries(List <SVR_AnimeSeries> series, ISessionWrapper session, IProvider prov) { foreach (SVR_AnimeSeries ser in series.Randomize()) { SVR_AniDB_Anime anim = ser.GetAnime(); if (anim != null) { ImageDetails banner = anim.GetDefaultWideBannerDetailsNoBlanks(session); if (banner != null) { return(banner.GenArt(prov)); } } } return(null); }