diff --git a/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.html b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.html new file mode 100644 index 000000000..f8a53db2e --- /dev/null +++ b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.html @@ -0,0 +1,11 @@ +
+ +
+ +
+
+
+ +
+
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.scss b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.scss new file mode 100644 index 000000000..728ff23c5 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.scss @@ -0,0 +1,19 @@ +.full-height { + height: 100%; +} + + +.small-middle-container{ + margin: auto; + width: 80%; +} + +.small-padding { + padding-left: 20px; + padding-right: 20px; + margin-bottom: 28px; +} + +.loading-spinner { + margin: 10%; +} \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts new file mode 100644 index 000000000..36496889b --- /dev/null +++ b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts @@ -0,0 +1,59 @@ +import { Component } from "@angular/core"; +import { ActivatedRoute } from "@angular/router"; +import { SearchV2Service, RequestService, MessageService } from "../../services"; +import { IActorCredits } from "../../interfaces/ISearchTvResultV2"; +import { IDiscoverCardResult } from "../interfaces"; +import { RequestType } from "../../interfaces"; + +@Component({ + templateUrl: "./discover-actor.component.html", + styleUrls: ["./discover-actor.component.scss"], +}) +export class DiscoverActorComponent { + public actorId: number; + public actorCredits: IActorCredits; + public loadingFlag: boolean; + + public discoverResults: IDiscoverCardResult[] = []; + + constructor(private searchService: SearchV2Service, + private route: ActivatedRoute, + private requestService: RequestService, + private messageService: MessageService) { + this.route.params.subscribe((params: any) => { + this.actorId = params.actorId; + this.loading(); + this.searchService.getMoviesByActor(this.actorId).subscribe(res => { + this.actorCredits = res; + this.createModel(); + }); + }); + } + + private createModel() { + this.finishLoading(); + this.discoverResults = []; + this.actorCredits.cast.forEach(m => { + this.discoverResults.push({ + available: false, // TODO + posterPath: `https://image.tmdb.org/t/p/w300/${m.poster_path}`, + requested: false, // TODO + title: m.title, + type: RequestType.movie, + id: m.id, + url: null, // TODO + rating: 0, + overview: m.overview, + approved: false // TODO + }); + }); + } + + private loading() { + this.loadingFlag = true; + } + + private finishLoading() { + this.loadingFlag = false; + } +} diff --git a/src/Ombi/ClientApp/src/app/discover/discover.module.ts b/src/Ombi/ClientApp/src/app/discover/discover.module.ts index cb40f9074..c67f3607b 100644 --- a/src/Ombi/ClientApp/src/app/discover/discover.module.ts +++ b/src/Ombi/ClientApp/src/app/discover/discover.module.ts @@ -12,10 +12,12 @@ import { PipeModule } from "../pipes/pipe.module"; import { DiscoverCardDetailsComponent } from "./card/discover-card-details.component"; import { MatDialog } from "@angular/material"; import { DiscoverCollectionsComponent } from "./collections/discover-collections.component"; +import { DiscoverActorComponent } from "./actor/discover-actor.component"; const routes: Routes = [ { path: "", component: DiscoverComponent, canActivate: [AuthGuard] }, - { path: "collection/:collectionId", component: DiscoverCollectionsComponent, canActivate: [AuthGuard] } + { path: "collection/:collectionId", component: DiscoverCollectionsComponent, canActivate: [AuthGuard] }, + { path: "actor/:actorId", component: DiscoverActorComponent, canActivate: [AuthGuard] } ]; @NgModule({ imports: [ @@ -29,6 +31,7 @@ const routes: Routes = [ DiscoverCardComponent, DiscoverCardDetailsComponent, DiscoverCollectionsComponent, + DiscoverActorComponent, ], entryComponents: [ DiscoverCardDetailsComponent diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResultV2.ts b/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResultV2.ts index 586f638e0..0d37acd71 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResultV2.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISearchTvResultV2.ts @@ -106,4 +106,31 @@ export interface ICharacterViewModel { export interface ICrew { type: string; person: IPersonViewModel; -} \ No newline at end of file +} + +export interface IActorCredits { + cast: IActorCast[]; + crew: IActorCrew[]; +} + +export interface IActorCast { + character: string; + poster_path: string; + id: number; + backdrop_path: string; + title: string; + overview: string; + release_date: Date; +} + +export interface IActorCrew { + id: number; + department: string; + job: string; + overview: string; + release_date: Date; + title: string; + backdrop_path: string; + poster_path: string; + credit_id: number; +} diff --git a/src/Ombi/ClientApp/src/app/media-details/components/shared/cast-carousel/cast-carousel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/shared/cast-carousel/cast-carousel.component.html index 5a6982efd..1e0cbea7e 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/shared/cast-carousel/cast-carousel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/shared/cast-carousel/cast-carousel.component.html @@ -5,9 +5,14 @@
- - + + + + + + +
{{'MediaDetails.Casts.Character' | translate}}: {{item.character}} diff --git a/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.html b/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.html index e08906de4..33930ebbb 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.html +++ b/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.html @@ -18,6 +18,11 @@ {{result.name}}
+ +
+   + {{result.name}} +
diff --git a/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.ts b/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.ts index e3a1d0800..ca55d0058 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.ts +++ b/src/Ombi/ClientApp/src/app/my-nav/nav-search.component.ts @@ -27,12 +27,14 @@ export class NavSearchComponent { title += ` (${result.release_date.slice(0,4)})`; } return title; - } else { + } else if (result.media_type === "tv") { let title = result.name; if(result.release_date) { title += ` (${result.release_date.slice(0,4)})`; } return title; + } else if(result.media_type === "person"){ + return result.name; } } @@ -40,8 +42,8 @@ export class NavSearchComponent { text$.pipe( debounceTime(600), distinctUntilChanged(), - switchMap(term => - this.searchService.multiSearch(term) + switchMap(term => term.length < 2 ? [] + : this.searchService.multiSearch(term) ) ) @@ -58,6 +60,9 @@ export class NavSearchComponent { } else if (event.item.media_type == "tv") { this.router.navigate([`details/tv/${event.item.id}/true`]); return; + } else if (event.item.media_type == "person") { + this.router.navigate([`discover/actor/${event.item.id}`]); + return; } } } diff --git a/src/Ombi/ClientApp/src/app/services/searchV2.service.ts b/src/Ombi/ClientApp/src/app/services/searchV2.service.ts index 61ae3a471..e57044b59 100644 --- a/src/Ombi/ClientApp/src/app/services/searchV2.service.ts +++ b/src/Ombi/ClientApp/src/app/services/searchV2.service.ts @@ -8,7 +8,7 @@ import { IMultiSearchResult, ISearchMovieResult, ISearchTvResult } from "../inte import { ServiceHelpers } from "./service.helpers"; import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2"; -import { ISearchTvResultV2, IMovieCollectionsViewModel } from "../interfaces/ISearchTvResultV2"; +import { ISearchTvResultV2, IMovieCollectionsViewModel, IActorCredits } from "../interfaces/ISearchTvResultV2"; @Injectable() export class SearchV2Service extends ServiceHelpers { @@ -94,4 +94,8 @@ export class SearchV2Service extends ServiceHelpers { public getMovieCollections(collectionId: number): Promise { return this.http.get(`${this.url}/movie/collection/${collectionId}`, { headers: this.headers }).toPromise(); } + + public getMoviesByActor(actorId: number): Observable { + return this.http.get(`${this.url}/actor/${actorId}/movie`, { headers: this.headers }); + } }