Merge branch 'develop-test' of https://github.com/tidusjar/Ombi into develop-test

pull/4003/head v4.0.1014
twanariens 4 years ago
commit bad06f9393

@ -59,7 +59,12 @@ namespace Ombi.Core.Engine
{ {
continue; continue;
} }
retVal.Add(await ProcessResult(tvMazeSearch, false)); var mappedResult = await ProcessResult(tvMazeSearch, false);
if (mappedResult == null)
{
continue;
}
retVal.Add(mappedResult);
} }
return retVal; return retVal;
} }
@ -194,7 +199,7 @@ namespace Ombi.Core.Engine
foreach (var tvMazeSearch in items) foreach (var tvMazeSearch in items)
{ {
var result = await ProcessResult(tvMazeSearch, includeImages); var result = await ProcessResult(tvMazeSearch, includeImages);
if(settings.HideAvailableFromDiscover && result.Available) if (result == null || settings.HideAvailableFromDiscover && result.Available)
{ {
continue; continue;
} }
@ -211,15 +216,17 @@ namespace Ombi.Core.Engine
private async Task<SearchTvShowViewModel> ProcessResult(SearchTvShowViewModel item, bool includeImages) private async Task<SearchTvShowViewModel> ProcessResult(SearchTvShowViewModel item, bool includeImages)
{ {
if (item.Id == 0)
{
return null;
}
item.TheTvDbId = item.Id.ToString(); item.TheTvDbId = item.Id.ToString();
if (includeImages) if (includeImages)
{ {
if (item.TheTvDbId.HasValue())
if (item.TheTvDbId.HasValue()) {
{ item.BackdropPath = await _imageService.GetTvBackground(item.TheTvDbId);
item.BackdropPath = await _imageService.GetTvBackground(item.TheTvDbId); }
}
} }
await RunSearchRules(item); await RunSearchRules(item);

@ -47,7 +47,7 @@ namespace Ombi.Mapping.Profiles
CreateMap<TraktShow, SearchTvShowViewModel>() CreateMap<TraktShow, SearchTvShowViewModel>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Ids.Tvdb.ToString()))) .ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.Ids.Tvdb.HasValue ? Convert.ToInt32(src.Ids.Tvdb.ToString()) : 0))
.ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.FirstAired.HasValue ? src.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty)) .ForMember(dest => dest.FirstAired, opts => opts.MapFrom(src => src.FirstAired.HasValue ? src.FirstAired.Value.ToString("yyyy-MM-ddTHH:mm:ss") : string.Empty))
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Ids.Imdb)) .ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Ids.Imdb))
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Network)) .ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Network))
@ -57,9 +57,9 @@ namespace Ombi.Mapping.Profiles
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Title)) .ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.Title))
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => TraktEnumHelper.GetDescription(src.Status))) .ForMember(dest => dest.Status, opts => opts.MapFrom(src => TraktEnumHelper.GetDescription(src.Status)))
.ForMember(dest => dest.Trailer, .ForMember(dest => dest.Trailer,
opts => opts.MapFrom(src => src.Trailer.ToString().ToHttpsUrl())) opts => opts.MapFrom(src => src.Trailer != null ? src.Trailer.ToString().ToHttpsUrl() : string.Empty))
.ForMember(dest => dest.Homepage, .ForMember(dest => dest.Homepage,
opts => opts.MapFrom(src => src.Homepage.ToString().ToHttpsUrl())); opts => opts.MapFrom(src => src.Homepage != null ? src.Homepage.ToString().ToHttpsUrl() : string.Empty));
} }
} }
} }
Loading…
Cancel
Save