Skip to content

Commit

Permalink
Merge pull request #404 from pmcleish/generate_contract_fix
Browse files Browse the repository at this point in the history
Follow up to #402: Removed redundant code and fixed incorrect ImageType
  • Loading branch information
ElementalCrisis authored Sep 9, 2016
2 parents ecf1d8e + a734f9c commit 92eb019
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions JMMServer/Entities/AniDB_Anime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2003,48 +2003,6 @@ private Contract_AniDBAnime GenerateContract(ISessionWrapper session, List<AniDB
contract.DefaultImagePoster = defPoster?.ToContract(session);
contract.DefaultImageWideBanner = defBanner?.ToContract(session);

// generate Fanarts and Banners
if (this.AnimeTypeEnum == enAnimeType.Movie)
{
List<MovieDB_Fanart> fanarts = GetMovieDBFanarts(session);
if (fanarts.Count > 0)
{
contract.Fanarts = new List<Contract_AniDB_Anime_DefaultImage>();
fanarts.ForEach(a => contract.Fanarts.Add(new Contract_AniDB_Anime_DefaultImage()
{
ImageType = (int) JMMImageType.MovieDB_FanArt,
MovieFanart = a.ToContract(),
AniDB_Anime_DefaultImageID = a.MovieDB_FanartID
}));
}
// MovieDB doesn't have banners
}
else
{
List<TvDB_ImageFanart> fanarts = GetTvDBImageFanarts(session);
if (fanarts.Count > 0)
{
contract.Fanarts = new List<Contract_AniDB_Anime_DefaultImage>();
fanarts.ForEach(a => contract.Fanarts.Add(new Contract_AniDB_Anime_DefaultImage()
{
ImageType = (int) JMMImageType.TvDB_FanArt,
TVFanart = a.ToContract(),
AniDB_Anime_DefaultImageID = a.TvDB_ImageFanartID
}));
}
List<TvDB_ImageWideBanner> banners = GetTvDBImageWideBanners(session);
if (banners.Count > 0)
{
contract.Banners = new List<Contract_AniDB_Anime_DefaultImage>();
banners.ForEach(a => contract.Banners.Add(new Contract_AniDB_Anime_DefaultImage()
{
ImageType = (int) JMMImageType.TvDB_Banner,
TVWideBanner = a.ToContract(),
AniDB_Anime_DefaultImageID = a.TvDB_ImageWideBannerID
}));
}
}

return contract;
}

Expand Down Expand Up @@ -2126,7 +2084,7 @@ private Contract_AniDBAnime GenerateContract(List<AniDB_Anime_Title> titles, Def
.ToList();
contract.Banners = tvDbBanners?.Select(a => new Contract_AniDB_Anime_DefaultImage
{
ImageType = (int)JMMImageType.TvDB_FanArt,
ImageType = (int)JMMImageType.TvDB_Banner,
TVWideBanner = a.ToContract(),
AniDB_Anime_DefaultImageID = a.TvDB_ImageWideBannerID
})
Expand Down

0 comments on commit 92eb019

Please sign in to comment.