mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
Fixed the TV search via Trakt not returning Images anymore. #865
This commit is contained in:
parent
3b18e4c291
commit
aab9194cf5
5 changed files with 50 additions and 7 deletions
|
@ -8,7 +8,7 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
{
|
||||
Task<IEnumerable<SearchTvShowViewModel>> Search(string searchTerm);
|
||||
|
||||
Task<SearchTvShowViewModel> GetShowInformation(int tvdbId);
|
||||
Task<SearchTvShowViewModel> GetShowInformation(int tvdbid);
|
||||
|
||||
Task<IEnumerable<SearchTvShowViewModel>> Popular();
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ namespace Ombi.Core.Engine
|
|||
return null;
|
||||
}
|
||||
|
||||
public async Task<SearchTvShowViewModel> GetShowInformation(int tvmazeId)
|
||||
public async Task<SearchTvShowViewModel> GetShowInformation(int tvdbid)
|
||||
{
|
||||
var show = await TvMazeApi.ShowLookup(tvmazeId);
|
||||
var show = await TvMazeApi.ShowLookupByTheTvDbId(tvdbid);
|
||||
var episodes = await TvMazeApi.EpisodeLookup(show.id);
|
||||
|
||||
var mapped = Mapper.Map<SearchTvShowViewModel>(show);
|
||||
|
@ -154,7 +154,7 @@ namespace Ombi.Core.Engine
|
|||
}
|
||||
}
|
||||
|
||||
if (item.Id > 0 && item.Available)
|
||||
if (item.Id > 0)
|
||||
{
|
||||
// TODO need to check if the episodes are available
|
||||
var tvdbid = item.Id;
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace Ombi.Core.Rule
|
|||
{
|
||||
RequestRules = new List<IRequestRules<BaseRequestModel>>();
|
||||
SearchRules = new List<IRequestRules<SearchViewModel>>();
|
||||
var baseSearchType = typeof(BaseSearchRule).FullName;
|
||||
var baseRequestType = typeof(BaseRequestRule).FullName;
|
||||
var baseSearchType = typeof(BaseRequestRule).FullName;
|
||||
var baseRequestType = typeof(BaseSearchRule).FullName;
|
||||
|
||||
var ass = typeof(RuleEvaluator).GetTypeInfo().Assembly;
|
||||
|
||||
|
|
|
@ -46,10 +46,32 @@ namespace Ombi.Mapping.Profiles
|
|||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.status))
|
||||
.ForMember(dest => dest.SeasonRequests, opts => opts.MapFrom(src => src.Season));
|
||||
|
||||
|
||||
|
||||
CreateMap<TvMazeCustomSeason, SeasonRequestModel>()
|
||||
.ConstructUsing(x =>
|
||||
{
|
||||
var season = new SeasonRequestModel
|
||||
{
|
||||
SeasonNumber = x.SeasonNumber
|
||||
};
|
||||
foreach (var ep in x.EpisodeNumber)
|
||||
{
|
||||
season.Episodes.Add(new EpisodesRequested
|
||||
{
|
||||
EpisodeNumber = ep,
|
||||
|
||||
});
|
||||
}
|
||||
return season;
|
||||
});
|
||||
|
||||
|
||||
|
||||
CreateMap<TraktShow, SearchTvShowViewModel>()
|
||||
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => Convert.ToInt32(src.Ids.Tvdb.ToString())))
|
||||
.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.Banner, opts => opts.MapFrom(src => src.Ids.Imdb))
|
||||
.ForMember(dest => dest.Banner, opts => opts.MapFrom(src => src.Images.Banner.Full))
|
||||
.ForMember(dest => dest.ImdbId, opts => opts.MapFrom(src => src.Ids.Imdb))
|
||||
.ForMember(dest => dest.Network, opts => opts.MapFrom(src => src.Network))
|
||||
.ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.Overview.RemoveHtml()))
|
||||
|
|
|
@ -70,6 +70,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => {
|
||||
this.tvResults = x;
|
||||
this.getExtraInfo();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -79,6 +80,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => {
|
||||
this.tvResults = x;
|
||||
this.getExtraInfo();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -88,6 +90,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => {
|
||||
this.tvResults = x;
|
||||
this.getExtraInfo();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -97,6 +100,18 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => {
|
||||
this.tvResults = x;
|
||||
this.getExtraInfo();
|
||||
});
|
||||
}
|
||||
|
||||
getExtraInfo() {
|
||||
this.tvResults.forEach((val, index) => {
|
||||
this.searchService.getShowInformation(val.id)
|
||||
.takeUntil(this.subscriptions)
|
||||
.subscribe(x => {
|
||||
this.updateItem(val,x);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -136,6 +151,12 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
|||
this.route.navigate(['/search/show', searchResult.seriesId]);
|
||||
}
|
||||
|
||||
private updateItem(key: ISearchTvResult, updated: ISearchTvResult) {
|
||||
var index = this.tvResults.indexOf(key, 0);
|
||||
if (index > -1) {
|
||||
this.tvResults[index] = updated;
|
||||
}
|
||||
}
|
||||
|
||||
private clearResults() {
|
||||
this.tvResults = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue