public async void GetStaff(long id) { AnimeCharactersStaff charactersStaff = await jikan.GetAnimeCharactersStaff(id); foreach (StaffPositionEntry staffMember in charactersStaff.Staff) { tempStaff = new StaffFromModels(); tempStaff.L_StaffImg = staffMember.ImageURL; tempStaff.L_StaffName = staffMember.Name; tempStaff.L_StaffRole = staffMember.Role.First(); AnimeStaff.Add(tempStaff); } }
/// <summary> /// Cast is aggregated, and therefore not in each provider /// </summary> /// <param name="ctx"></param> /// <param name="animeID"></param> /// <returns></returns> public static List <Role> GetCast(HttpContext ctx, int animeID) { List <Role> roles = new List <Role>(); var xrefAnimeStaff = RepoFactory.CrossRef_Anime_Staff.GetByAnimeIDAndRoleType(animeID, StaffRoleType.Seiyuu); foreach (var xref in xrefAnimeStaff) { if (xref.RoleID == null) { continue; } AnimeCharacter character = RepoFactory.AnimeCharacter.GetByID(xref.RoleID.Value); if (character == null) { continue; } AnimeStaff staff = RepoFactory.AnimeStaff.GetByID(xref.StaffID); if (staff == null) { continue; } Role role = new Role { Character = new Role.Person { Name = character.Name, AlternateName = character.AlternateName, Image = new Image(xref.RoleID.Value, ImageEntityType.Character), Description = character.Description }, Staff = new Role.Person { Name = staff.Name, AlternateName = staff.AlternateName, Description = staff.Description, Image = new Image(xref.StaffID, ImageEntityType.Staff), }, RoleName = ((StaffRoleType)xref.RoleType).ToString(), RoleDetails = xref.Role }; roles.Add(role); } return(roles); }
/// <summary> /// Cast is aggregated, and therefore not in each provider /// </summary> /// <param name="ctx"></param> /// <param name="animeID"></param> /// <param name="roleType"></param> /// <returns></returns> public static List <Role> GetCast(HttpContext ctx, int animeID, Role.CreatorRoleType?roleType = null) { List <Role> roles = new List <Role>(); var xrefAnimeStaff = roleType.HasValue ? RepoFactory.CrossRef_Anime_Staff.GetByAnimeIDAndRoleType(animeID, (StaffRoleType)roleType.Value) : RepoFactory.CrossRef_Anime_Staff.GetByAnimeID(animeID); foreach (var xref in xrefAnimeStaff) { AnimeCharacter character = xref.RoleID.HasValue ? RepoFactory.AnimeCharacter.GetByID(xref.RoleID.Value) : null; AnimeStaff staff = RepoFactory.AnimeStaff.GetByID(xref.StaffID); if (staff == null) { continue; } Role role = new Role { Character = character != null ? new Role.Person { Name = character.Name, AlternateName = character.AlternateName, Image = new Image(character.CharacterID, ImageEntityType.Character), Description = character.Description } : null, Staff = new Role.Person { Name = staff.Name, AlternateName = staff.AlternateName, Description = staff.Description, Image = staff.ImagePath != null ? new Image(staff.StaffID, ImageEntityType.Staff) : null, }, RoleName = (Role.CreatorRoleType)xref.RoleType, RoleDetails = xref.Role }; roles.Add(role); } return(roles); }
public void GenerateFromAniDB_Anime(HttpContext ctx, SVR_AniDB_Anime anime) { anidb_id = anime.AnimeID; restricted = anime.Restricted == 1; if (ctx.Items.ContainsKey("description")) { description = new List <Description> { new Description { source = "AniDB", language = "en", description = anime.Description } }; } ratings = new List <Rating> { new Rating { source = "AniDB", rating = (decimal)anime.Rating / 10, max_rating = 100, votes = anime.VoteCount } }; name = anime.MainTitle; series_type = anime.AnimeType.ToString(); if (anime.AirDate != null) { var airdate = anime.AirDate.Value; if (airdate != DateTime.MinValue) { air_date = airdate.ToString("yyyy-MM-dd"); } } if (anime.EndDate != null) { var enddate = anime.EndDate.Value; if (enddate != DateTime.MinValue) { end_date = enddate.ToString("yyyy-MM-dd"); } } AniDB_Vote vote = Repo.Instance.AniDB_Vote.GetByEntityAndType(anime.AnimeID, AniDBVoteType.Anime) ?? Repo.Instance.AniDB_Vote.GetByEntityAndType(anime.AnimeID, AniDBVoteType.AnimeTemp); if (vote != null) { string voteType = (AniDBVoteType)vote.VoteType == AniDBVoteType.Anime ? "Permanent" : "Temporary"; user_rating = new Rating { rating = (decimal)Math.Round(vote.VoteValue / 100D, 1), max_rating = 10, type = voteType, source = "User" }; } if (ctx.Items.ContainsKey("titles")) { titles = anime.GetTitles().Select(title => new Title { language = title.Language, title = title.Title, type = title.TitleType }).ToList(); } PopulateArtFromAniDBAnime(ctx, anime); if (ctx.Items.ContainsKey("cast")) { var xref_animestaff = Repo.Instance.CrossRef_Anime_Staff.GetByAnimeIDAndRoleType(anime.AnimeID, StaffRoleType.Seiyuu); foreach (var xref in xref_animestaff) { if (xref.RoleID == null) { continue; } AnimeCharacter character = Repo.Instance.AnimeCharacter.GetByID(xref.RoleID.Value); if (character == null) { continue; } AnimeStaff staff = Repo.Instance.AnimeStaff.GetByID(xref.StaffID); if (staff == null) { continue; } Role role = new Role { character = new Role.Person { name = character.Name, alternate_name = character.AlternateName, image = new Image(ctx, xref.RoleID.Value, ImageEntityType.Character), description = character.Description }, staff = new Role.Person { name = staff.Name, alternate_name = staff.AlternateName, description = staff.Description, image = new Image(ctx, xref.StaffID, ImageEntityType.Staff), }, role = ((StaffRoleType)xref.RoleType).ToString(), role_details = xref.Role }; if (cast == null) { cast = new List <Role>(); } cast.Add(role); } } if (ctx.Items.ContainsKey("tags")) { var animeTags = anime.GetAllTags(); if (animeTags != null) { if (!ctx.Items.TryGetValue("tagfilter", out object tagfilter)) { tagfilter = 0; } tags = TagFilter.ProcessTags((TagFilter.Filter)tagfilter, animeTags.ToList()); } } }