movieDbId was switched to string fron number so accomodated for change

This commit is contained in:
Anojh 2018-03-23 16:13:51 -07:00
commit 892ce167c9
3 changed files with 8 additions and 8 deletions

View file

@ -93,11 +93,11 @@ export class IssueDetailsComponent implements OnInit {
private setBackground(issue: any) { private setBackground(issue: any) {
if (issue.requestType === 1) { if (issue.requestType === 1) {
this.imageService.getMovieBackground(Number(issue.providerId)).subscribe(x => { this.imageService.getMovieBackground(issue.providerId).subscribe(x => {
this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle
("url(" + x + ")"); ("url(" + x + ")");
}); });
this.imageService.getMoviePoster(Number(issue.providerId)).subscribe(x => { this.imageService.getMoviePoster(issue.providerId).subscribe(x => {
this.posterPath = x.toString(); this.posterPath = x.toString();
}); });

View file

@ -21,7 +21,7 @@ export class ImageService extends ServiceHelpers {
return this.http.get<string>(`${this.url}tv/${tvdbid}`, {headers: this.headers}); return this.http.get<string>(`${this.url}tv/${tvdbid}`, {headers: this.headers});
} }
public getMoviePoster(movieDbId: number): Observable<string> { public getMoviePoster(movieDbId: string): Observable<string> {
return this.http.get<string>(`${this.url}poster/movie/${movieDbId}`, { headers: this.headers }); return this.http.get<string>(`${this.url}poster/movie/${movieDbId}`, { headers: this.headers });
} }
@ -29,7 +29,7 @@ export class ImageService extends ServiceHelpers {
return this.http.get<string>(`${this.url}poster/tv/${tvdbid}`, { headers: this.headers }); return this.http.get<string>(`${this.url}poster/tv/${tvdbid}`, { headers: this.headers });
} }
public getMovieBackground(movieDbId: number): Observable<string> { public getMovieBackground(movieDbId: string): Observable<string> {
return this.http.get<string>(`${this.url}background/movie/${movieDbId}`, { headers: this.headers }); return this.http.get<string>(`${this.url}background/movie/${movieDbId}`, { headers: this.headers });
} }

View file

@ -58,7 +58,7 @@ namespace Ombi.Controllers
} }
[HttpGet("poster/movie/{movieDbId}")] [HttpGet("poster/movie/{movieDbId}")]
public async Task<string> GetMoviePoster(int movieDbId) public async Task<string> GetMoviePoster(string movieDbId)
{ {
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
@ -118,7 +118,7 @@ namespace Ombi.Controllers
} }
[HttpGet("background/movie/{movieDbId}")] [HttpGet("background/movie/{movieDbId}")]
public async Task<string> GetMovieBackground(int movieDbId) public async Task<string> GetMovieBackground(string movieDbId)
{ {
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
@ -182,11 +182,11 @@ namespace Ombi.Controllers
if (moviesArray.Any()) if (moviesArray.Any())
{ {
var item = rand.Next(moviesArray.Length); var item = rand.Next(moviesArray.Length);
var result = await FanartTvApi.GetMovieImages(moviesArray[item], key.Value); var result = await FanartTvApi.GetMovieImages(moviesArray[item].ToString(), key.Value);
while (!result.moviebackground.Any()) while (!result.moviebackground.Any())
{ {
result = await FanartTvApi.GetMovieImages(moviesArray[item], key.Value); result = await FanartTvApi.GetMovieImages(moviesArray[item].ToString(), key.Value);
} }
movieUrl = result.moviebackground[0].url; movieUrl = result.moviebackground[0].url;