From 0ff920fdb3d77a84168ea877196906e6e3924f9d Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 28 Aug 2018 20:26:26 +0100 Subject: [PATCH] Fixed #2475 --- src/Ombi.Core/Engine/TvSearchEngine.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Ombi.Core/Engine/TvSearchEngine.cs b/src/Ombi.Core/Engine/TvSearchEngine.cs index 253363ec1..bb674a35d 100644 --- a/src/Ombi.Core/Engine/TvSearchEngine.cs +++ b/src/Ombi.Core/Engine/TvSearchEngine.cs @@ -54,7 +54,16 @@ namespace Ombi.Core.Engine if (searchResult != null) { - return await ProcessResults(searchResult); + var retVal = new List(); + foreach (var tvMazeSearch in searchResult) + { + if (tvMazeSearch.show.externals == null || !(tvMazeSearch.show.externals?.thetvdb.HasValue ?? false)) + { + continue; + } + retVal.Add(await ProcessResult(tvMazeSearch)); + } + return retVal; } return null; } @@ -145,12 +154,16 @@ namespace Ombi.Core.Engine var retVal = new List(); foreach (var tvMazeSearch in items) { - var viewT = Mapper.Map(tvMazeSearch); - retVal.Add(await ProcessResult(viewT)); + retVal.Add(await ProcessResult(tvMazeSearch)); } return retVal; } + private async Task ProcessResult(T tvMazeSearch) + { + return Mapper.Map(tvMazeSearch); + } + private async Task ProcessResult(SearchTvShowViewModel item) { item.TheTvDbId = item.Id.ToString();