Fixed: Don't store incomplete image URLs (image doesn't exist)

pull/4/head
Mark McDowall 10 years ago
parent d4331e9470
commit f4169e165c

@ -142,9 +142,20 @@ namespace NzbDrone.Core.MetadataSource
series.Actors = new List<Tv.Actor>(); series.Actors = new List<Tv.Actor>();
series.Seasons = GetSeasons(show); series.Seasons = GetSeasons(show);
if (show.Banner != null)
{
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Banner, Url = show.Banner.ToString() }); series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Banner, Url = show.Banner.ToString() });
}
if (show.Poster != null)
{
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = show.Poster.ToString() }); series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = show.Poster.ToString() });
}
if (show.Fanart != null)
{
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Fanart, Url = show.Fanart.ToString() }); series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Fanart, Url = show.Fanart.ToString() });
}
return series; return series;
} }
@ -166,7 +177,10 @@ namespace NzbDrone.Core.MetadataSource
episode.Ratings = GetRatings(traktEpisode.RatingCount, traktEpisode.Rating); episode.Ratings = GetRatings(traktEpisode.RatingCount, traktEpisode.Rating);
//Don't include series fanart images as episode screenshot //Don't include series fanart images as episode screenshot
if (traktEpisode.EpisodeImage != null)
{
episode.Images.Add(new MediaCover.MediaCover(MediaCoverTypes.Screenshot, traktEpisode.EpisodeImage.ToString())); episode.Images.Add(new MediaCover.MediaCover(MediaCoverTypes.Screenshot, traktEpisode.EpisodeImage.ToString()));
}
return episode; return episode;
} }

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Xml.Linq; using System.Xml.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using TVDBSharp.Models.DAO; using TVDBSharp.Models.DAO;
using TVDBSharp.Models.Enums; using TVDBSharp.Models.Enums;
@ -82,6 +83,11 @@ namespace TVDBSharp.Models
private static Uri GetBannerUri(string uriSuffix) private static Uri GetBannerUri(string uriSuffix)
{ {
if (uriSuffix.IsNullOrWhiteSpace())
{
return null;
}
return new Uri(UriPrefix + uriSuffix, UriKind.Absolute); return new Uri(UriPrefix + uriSuffix, UriKind.Absolute);
} }

Loading…
Cancel
Save