From db4123b4ea5ccf4ea2395593b72da62cd748dc43 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 5 Mar 2021 08:14:39 +0000 Subject: [PATCH] wip --- src/Ombi.Core/Engine/TvSearchEngine.cs | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Ombi.Core/Engine/TvSearchEngine.cs b/src/Ombi.Core/Engine/TvSearchEngine.cs index 87605cce5..bcede50d6 100644 --- a/src/Ombi.Core/Engine/TvSearchEngine.cs +++ b/src/Ombi.Core/Engine/TvSearchEngine.cs @@ -76,42 +76,42 @@ namespace Ombi.Core.Engine return null; } - public async Task GetShowInformation(int tvdbid) + public async Task GetShowInformation(string theMovieDbId) { - var show = await Cache.GetOrAdd(nameof(GetShowInformation) + tvdbid, - async () => await TvMazeApi.ShowLookupByTheTvDbId(tvdbid), DateTime.Now.AddHours(12)); + var show = await Cache.GetOrAdd(nameof(GetShowInformation) + theMovieDbId, + async () => await _theMovieDbApi.GetTVInfo(theMovieDbId), DateTime.Now.AddHours(12)); if (show == null) { // We don't have enough information return null; } - var episodes = await Cache.GetOrAdd("TvMazeEpisodeLookup" + show.id, - async () => await TvMazeApi.EpisodeLookup(show.id), DateTime.Now.AddHours(12)); - if (episodes == null || !episodes.Any()) - { - // We don't have enough information - return null; - } + //var episodes = await Cache.GetOrAdd("TvMazeEpisodeLookup" + show.id, + // async () => await TvMazeApi.EpisodeLookup(show.id), DateTime.Now.AddHours(12)); + //if (episodes == null || !episodes.Any()) + //{ + // // We don't have enough information + // return null; + //} var mapped = Mapper.Map(show); - foreach (var e in episodes) + foreach (var e in show.seasons) { - var season = mapped.SeasonRequests.FirstOrDefault(x => x.SeasonNumber == e.season); + var season = mapped.SeasonRequests.FirstOrDefault(x => x.SeasonNumber == e.season_number); if (season == null) { var newSeason = new SeasonRequests { - SeasonNumber = e.season, + SeasonNumber = e.season_number, Episodes = new List() }; newSeason.Episodes.Add(new EpisodeRequests { - Url = e.url.ToHttpsUrl(), + //Url = e..ToHttpsUrl(), Title = e.name, - AirDate = e.airstamp.HasValue() ? DateTime.Parse(e.airstamp) : DateTime.MinValue, - EpisodeNumber = e.number, + AirDate = e.air_date.HasValue() ? DateTime.Parse(e.air_date) : DateTime.MinValue, + EpisodeNumber = e, }); mapped.SeasonRequests.Add(newSeason);