Revert "Fixed: Breaking trakt API changes (Posters for add series are placeholders for now)"

This reverts commit 66ca925b0d.
pull/2/head
Mark McDowall 10 years ago
parent 66ca925b0d
commit 0f56bfac2f

@ -27,9 +27,9 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
[TestCase("South Park", "South Park")]
[TestCase("Franklin & Bash", "Franklin & Bash")]
[TestCase("Mr. D", "Mr. D")]
[TestCase("Rob & Big", "Rob & Big")]
//[TestCase("M*A*S*H", "M*A*S*H")]
//[TestCase("imdb:tt0436992", "Doctor Who (2005)")]
[TestCase("Rob & Big", "Rob and Big")]
[TestCase("M*A*S*H", "M*A*S*H")]
[TestCase("imdb:tt0436992", "Doctor Who (2005)")]
[TestCase("tvdb:78804", "Doctor Who (2005)")]
public void successful_search(string title, string expected)
{
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
}
[TestCase(75978, "Family Guy")]
[TestCase(83462, "Castle")]
[TestCase(83462, "Castle (2009)")]
[TestCase(266189, "The Blacklist")]
public void should_be_able_to_get_series_detail(Int32 tvdbId, String title)
{
@ -68,13 +68,13 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
ExceptionVerification.ExpectedWarns(1);
}
// [Test]
// public void should_not_have_period_at_start_of_title_slug()
// {
// var details = Subject.GetSeriesInfo(79099);
//
// details.Item1.TitleSlug.Should().Be("dothack");
// }
[Test]
public void should_not_have_period_at_start_of_title_slug()
{
var details = Subject.GetSeriesInfo(79099);
details.Item1.TitleSlug.Should().Be("dothack");
}
private void ValidateSeries(Series series)
{

@ -4,7 +4,7 @@ namespace NzbDrone.Core.MetadataSource.Trakt
{
public class Ratings
{
public Decimal percentage { get; set; }
public Int32 percentage { get; set; }
public Int32 votes { get; set; }
public Int32 loved { get; set; }
public Int32 hated { get; set; }

@ -146,7 +146,10 @@ namespace NzbDrone.Core.MetadataSource
series.Certification = show.certification;
series.Actors = GetActors(show.people);
series.Seasons = GetSeasons(show);
series.Images = GetImages(show.images);
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Banner, Url = show.images.banner });
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = GetPosterThumbnailUrl(show.images.poster) });
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Fanart, Url = show.images.fanart });
return series;
}
@ -175,7 +178,7 @@ namespace NzbDrone.Core.MetadataSource
episode.Ratings = GetRatings(traktEpisode.ratings);
//Don't include series fanart images as episode screenshot
if (traktEpisode.images != null && traktEpisode.images.screen != null && !traktEpisode.images.screen.Contains("-940."))
if (!traktEpisode.images.screen.Contains("-940."))
{
episode.Images.Add(new MediaCover.MediaCover(MediaCoverTypes.Screenshot, traktEpisode.images.screen));
}
@ -185,12 +188,11 @@ namespace NzbDrone.Core.MetadataSource
private static string GetPosterThumbnailUrl(string posterUrl)
{
if (posterUrl.Contains("poster-small.jpg") || posterUrl.Contains("poster-dark.jpg"))
{
return posterUrl;
}
if (posterUrl.Contains("poster-small.jpg") || posterUrl.Contains("poster-dark.jpg")) return posterUrl;
return posterUrl.Replace("/original/", "/thumb/");
var extension = Path.GetExtension(posterUrl);
var withoutExtension = posterUrl.Substring(0, posterUrl.Length - extension.Length);
return withoutExtension + "-300" + extension;
}
private static SeriesStatusType GetSeriesStatus(string status, bool? ended)
@ -258,11 +260,6 @@ namespace NzbDrone.Core.MetadataSource
private static Tv.Ratings GetRatings(Trakt.Ratings ratings)
{
if (ratings == null)
{
return new Tv.Ratings();
}
return new Tv.Ratings
{
Percentage = ratings.percentage,
@ -282,14 +279,9 @@ namespace NzbDrone.Core.MetadataSource
return GetActors(people.actors).ToList();
}
private static IEnumerable<Tv.Actor> GetActors(IEnumerable<Trakt.Actor> traktActors)
private static IEnumerable<Tv.Actor> GetActors(IEnumerable<Trakt.Actor> trakcActors)
{
if (traktActors == null)
{
yield break;
}
foreach (var traktActor in traktActors)
foreach (var traktActor in trakcActors)
{
var actor = new Tv.Actor
{
@ -324,32 +316,5 @@ namespace NzbDrone.Core.MetadataSource
return seasons;
}
private static List<MediaCover.MediaCover> GetImages(Images traktImages)
{
var images = new List<MediaCover.MediaCover>();
if (traktImages == null)
{
return images;
}
if (traktImages.banner != null)
{
images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Banner, Url = traktImages.banner });
}
if (traktImages.poster != null)
{
images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = GetPosterThumbnailUrl(traktImages.poster) });
}
if (traktImages.fanart != null)
{
images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Fanart, Url = traktImages.fanart });
}
return images;
}
}
}

@ -5,7 +5,7 @@ namespace NzbDrone.Core.Tv
{
public class Ratings : IEmbeddedDocument
{
public Decimal Percentage { get; set; }
public Int32 Percentage { get; set; }
public Int32 Votes { get; set; }
public Int32 Loved { get; set; }
public Int32 Hated { get; set; }

@ -1,3 +1,3 @@
<div class="text-center hint col-md-12">
<span>You can also search by tvdbid using the tvdb: prefix.</span>
<span>You can also search by tvdbid and imdbid using the tvdb: and imdb: prefixes.</span>
</div>

Loading…
Cancel
Save