diff --git a/src/Ombi/ClientApp/app/app.component.html b/src/Ombi/ClientApp/app/app.component.html
index 4cb2c3bdd..16efe8a4c 100644
--- a/src/Ombi/ClientApp/app/app.component.html
+++ b/src/Ombi/ClientApp/app/app.component.html
@@ -38,7 +38,7 @@
diff --git a/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts b/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts
index a81a9db50..bce430f76 100644
--- a/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts
+++ b/src/Ombi/ClientApp/app/interfaces/IRecentlyAdded.ts
@@ -7,6 +7,9 @@ export interface IRecentlyAddedMovies {
releaseYear: string;
addedAt: Date;
quality: string;
+
+ // For UI only
+ posterPath: string;
}
export interface IRecentlyAddedRangeModel {
diff --git a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.html b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.html
index eb2c40dbe..72a1d3a6f 100644
--- a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.html
+++ b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.html
@@ -3,4 +3,15 @@
+
+
+
+
+
+ {{movie.title}}
+
+
+
+
+
{{movies | json}}
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts
index c48b1ae3d..4df26b285 100644
--- a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts
+++ b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts
@@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core";
-import { RecentlyAddedService } from "../services/index";
+import { ImageService, RecentlyAddedService } from "../services";
import { IRecentlyAddedMovies, IRecentlyAddedRangeModel } from "./../interfaces";
@Component({
@@ -11,7 +11,8 @@ export class RecentlyAddedComponent implements OnInit {
public movies: IRecentlyAddedMovies[];
public range: Date[];
- constructor(private recentlyAddedService: RecentlyAddedService) {}
+ constructor(private recentlyAddedService: RecentlyAddedService,
+ private imageService: ImageService) {}
public ngOnInit() {
const weekAgo = new Date();
@@ -19,7 +20,19 @@ export class RecentlyAddedComponent implements OnInit {
const today =new Date();
const initModel = {from: weekAgo, to: today};
- this.recentlyAddedService.getRecentlyAddedMovies(initModel).subscribe(x => this.movies = x);
+ this.recentlyAddedService.getRecentlyAddedMovies(initModel).subscribe(x => {
+ this.movies = x;
+
+ this.movies.forEach((movie) => {
+ if(movie.theMovieDbId) {
+ this.imageService.getMoviePoster(movie.theMovieDbId).subscribe(p => {
+ movie.posterPath = p;
+ });
+ } else {
+ movie.posterPath = "";
+ }
+ });
+ });
}
public close() {
@@ -33,4 +46,9 @@ export class RecentlyAddedComponent implements OnInit {
const initModel = {from: this.range[0], to: this.range[1]};
this.recentlyAddedService.getRecentlyAddedMovies(initModel).subscribe(x => this.movies = x);
}
+
+ public page(event: any) {
+ debugger;
+ console.log(event);
+ }
}
diff --git a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.module.ts b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.module.ts
index 0b0cb96bf..883ac2c41 100644
--- a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.module.ts
+++ b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.module.ts
@@ -3,9 +3,9 @@ import { RouterModule, Routes } from "@angular/router";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { OrderModule } from "ngx-order-pipe";
-import { CalendarModule, PaginatorModule, SharedModule, TabViewModule } from "primeng/primeng";
+import { CalendarModule, CarouselModule, PaginatorModule, SharedModule, TabViewModule } from "primeng/primeng";
-import { IdentityService, RecentlyAddedService } from "../services";
+import { IdentityService, ImageService, RecentlyAddedService } from "../services";
import { AuthGuard } from "../auth/auth.guard";
@@ -27,6 +27,7 @@ const routes: Routes = [
PaginatorModule,
TabViewModule,
CalendarModule,
+ CarouselModule,
],
declarations: [
RecentlyAddedComponent,
@@ -37,6 +38,7 @@ const routes: Routes = [
providers: [
IdentityService,
RecentlyAddedService,
+ ImageService,
],
})
diff --git a/src/Ombi/ClientApp/app/services/image.service.ts b/src/Ombi/ClientApp/app/services/image.service.ts
index 022f382ca..479a21157 100644
--- a/src/Ombi/ClientApp/app/services/image.service.ts
+++ b/src/Ombi/ClientApp/app/services/image.service.ts
@@ -19,5 +19,11 @@ export class ImageService extends ServiceHelpers {
public getTvBanner(tvdbid: number): Observable {
return this.http.get(`${this.url}tv/${tvdbid}`, {headers: this.headers});
+ }
+ public getMoviePoster(themoviedbid: string): Observable {
+ return this.http.get(`${this.url}poster/movie/${themoviedbid}`, {headers: this.headers});
+ }
+ public getTvPoster(tvdbid: number): Observable {
+ return this.http.get(`${this.url}poster/tv/${tvdbid}`, {headers: this.headers});
}
}
diff --git a/src/Ombi/Controllers/ImagesController.cs b/src/Ombi/Controllers/ImagesController.cs
index a6d18bad0..7f2e0a47f 100644
--- a/src/Ombi/Controllers/ImagesController.cs
+++ b/src/Ombi/Controllers/ImagesController.cs
@@ -37,6 +37,10 @@ namespace Ombi.Controllers
var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
var images = await Api.GetTvImages(tvdbid, key.Value);
+ if (images == null)
+ {
+ return string.Empty;
+ }
if (images.tvbanner != null)
{
return images.tvbanner.FirstOrDefault()?.url ?? string.Empty;
@@ -48,6 +52,56 @@ namespace Ombi.Controllers
return string.Empty;
}
+ [HttpGet("poster/movie/{movieDbId}")]
+ public async Task GetMoviePoster(int movieDbId)
+ {
+ var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
+
+ var images = await Api.GetMovieImages(movieDbId, key.Value);
+
+ if (images == null)
+ {
+ return string.Empty;
+ }
+
+ if (images.movieposter?.Any() ?? false)
+ {
+ return images.movieposter.OrderBy(x => x.likes).Select(x => x.url).FirstOrDefault();
+ }
+
+ if (images.hdmovieclearart?.Any() ?? false)
+ {
+ return images.hdmovieclearart.OrderBy(x => x.likes).Select(x => x.url).FirstOrDefault();
+ }
+
+ return string.Empty;
+ }
+
+ [HttpGet("poster/tv/{tvdbid}")]
+ public async Task GetTvPoster(int tvdbid)
+ {
+ var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1));
+
+ var images = await Api.GetTvImages(tvdbid, key.Value);
+
+ if (images == null)
+ {
+ return string.Empty;
+ }
+
+ if (images.tvposter?.Any() ?? false)
+ {
+ return images.tvposter.OrderBy(x => x.likes).Select(x => x.url).FirstOrDefault();
+ }
+
+ if (images.tvthumb?.Any() ?? false)
+ {
+ return images.tvthumb.OrderBy(x => x.likes).Select(x => x.url).FirstOrDefault();
+ }
+
+ return string.Empty;
+ }
+
[HttpGet("background")]
public async Task