emergency hack to fix breaking trakt api.

pull/4/head
kay.one 11 years ago
parent 7417f76086
commit 5557ac8454

@ -29,4 +29,31 @@ namespace NzbDrone.Core.MetadataSource.Trakt
public List<string> genres { get; set; }
public List<Season> seasons { get; set; }
}
public class SearchShow
{
public string title { get; set; }
public int year { get; set; }
public string url { get; set; }
public int first_aired { get; set; }
public string first_aired_iso { get; set; }
public int first_aired_utc { get; set; }
public string country { get; set; }
public string overview { get; set; }
public int runtime { get; set; }
public string status { get; set; }
public string network { get; set; }
public string air_day { get; set; }
public string air_day_utc { get; set; }
public string air_time { get; set; }
public string air_time_utc { get; set; }
public string certification { get; set; }
public string imdb_id { get; set; }
public int tvdb_id { get; set; }
public int tvrage_id { get; set; }
public int last_updated { get; set; }
public string poster { get; set; }
public Images images { get; set; }
public List<string> genres { get; set; }
}
}

@ -19,9 +19,9 @@ namespace NzbDrone.Core.MetadataSource
{
var client = BuildClient("search", "shows");
var restRequest = new RestRequest(GetSearchTerm(title));
var response = client.ExecuteAndValidate<List<Show>>(restRequest);
var response = client.ExecuteAndValidate<List<SearchShow>>(restRequest);
return response.Select(MapSeries).ToList();
return response.Select(MapSearchSeries).ToList();
}
@ -77,6 +77,28 @@ namespace NzbDrone.Core.MetadataSource
return series;
}
private static Series MapSearchSeries(SearchShow show)
{
var series = new Series();
series.TvdbId = show.tvdb_id;
series.TvRageId = show.tvrage_id;
series.ImdbId = show.imdb_id;
series.Title = show.title;
series.CleanTitle = Parser.Parser.CleanSeriesTitle(show.title);
series.FirstAired = FromIso(show.first_aired_iso);
series.Overview = show.overview;
series.Runtime = show.runtime;
series.Network = show.network;
series.AirTime = show.air_time_utc;
series.TitleSlug = show.url.ToLower().Replace("http://trakt.tv/show/", "");
series.Status = GetSeriesStatus(show.status);
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;
}
private static Episode MapEpisode(Trakt.Episode traktEpisode)
{
var episode = new Episode();

@ -297,7 +297,7 @@
<Compile Include="MetadataSource\Trakt\Episode.cs" />
<Compile Include="MetadataSource\Trakt\Images.cs" />
<Compile Include="MetadataSource\Trakt\Season.cs" />
<Compile Include="MetadataSource\Trakt\Show.cs" />
<Compile Include="MetadataSource\Trakt\FullShow.cs" />
<Compile Include="Notifications\INotifcationSettings.cs" />
<Compile Include="Notifications\Plex\TestPlexServerCommand.cs" />
<Compile Include="Notifications\Plex\PlexServer.cs" />

Loading…
Cancel
Save