mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
emergency hack to fix breaking trakt api.
This commit is contained in:
parent
9d5f6fcbc7
commit
f72d4dd394
@ -29,4 +29,31 @@ public class Show
|
||||
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 @@ public List<Series> SearchForNewSeries(string title)
|
||||
{
|
||||
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 @@ private static Series MapSeries(Show show)
|
||||
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…
Reference in New Issue
Block a user