From c18efc5a3ac9208cd25d59e74f9acab48d7b41bb Mon Sep 17 00:00:00 2001 From: TidusJar Date: Thu, 28 Feb 2019 12:20:40 +0000 Subject: [PATCH] more more more !wip --- .../Engine/Interfaces/IMovieRequestEngine.cs | 2 +- src/Ombi.Core/Engine/MovieRequestEngine.cs | 13 +- .../media-details.component.scss | 6 +- .../app/media-details/media-details.module.ts | 2 + .../movie/movie-details.component.html | 27 ++-- .../movie/movie-details.component.ts | 22 ++- .../movie-information-panel.component.html | 118 +++++++++------- .../tv-information-panel.component.html | 61 ++++++++ .../panels/tv-information-panel.component.ts | 12 ++ .../tv/tv-details.component.html | 132 ++++++------------ .../src/app/search/moviesearch.component.html | 8 +- .../src/app/services/request.service.ts | 4 + src/Ombi/Controllers/V1/RequestController.cs | 10 ++ 13 files changed, 256 insertions(+), 161 deletions(-) create mode 100644 src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.html create mode 100644 src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.ts diff --git a/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs b/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs index d741dc8bc..6e4c9dd89 100644 --- a/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs @@ -13,7 +13,7 @@ namespace Ombi.Core.Engine.Interfaces Task RemoveMovieRequest(int requestId); Task RemoveAllMovieRequests(); - + Task GetRequest(int requestId); Task UpdateMovieRequest(MovieRequests request); Task ApproveMovie(MovieRequests request); Task ApproveMovieById(int requestId); diff --git a/src/Ombi.Core/Engine/MovieRequestEngine.cs b/src/Ombi.Core/Engine/MovieRequestEngine.cs index 456ba267a..b43e516de 100644 --- a/src/Ombi.Core/Engine/MovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/MovieRequestEngine.cs @@ -259,6 +259,15 @@ namespace Ombi.Core.Engine return allRequests; } + public async Task GetRequest(int requestId) + { + var request = await MovieRepository.GetWithUser().Where(x => x.Id == requestId).FirstOrDefaultAsync(); + request.PosterPath = PosterPathHelper.FixPosterPath(request.PosterPath); + await CheckForSubscription(new HideResult(), request); + + return request; + } + private async Task CheckForSubscription(HideResult shouldHide, MovieRequests x) { if (shouldHide.UserId == x.RequestedUserId) @@ -493,7 +502,7 @@ namespace Ombi.Core.Engine RequestType = RequestType.Movie, }); - return new RequestEngineResult {Result = true, Message = $"{movieName} has been successfully added!", RequestId = model.Id}; + return new RequestEngineResult { Result = true, Message = $"{movieName} has been successfully added!", RequestId = model.Id }; } public async Task GetRemainingRequests(OmbiUser user) @@ -533,7 +542,7 @@ namespace Ombi.Core.Engine return new RequestQuotaCountModel() { - HasLimit = true, + HasLimit = true, Limit = limit, Remaining = count, NextRequest = DateTime.SpecifyKind(oldestRequestedAt.AddDays(7), DateTimeKind.Utc), diff --git a/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss b/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss index 22a7b791c..a75222ff6 100644 --- a/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss +++ b/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss @@ -157,7 +157,11 @@ } .spacing-below { - margin-bottom: 15px; + margin-bottom: 15px !important; +} + +.left-seperator { + margin-left:40px; } .tagline { diff --git a/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts b/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts index 7c08c39bd..8264be785 100644 --- a/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts +++ b/src/Ombi/ClientApp/src/app/media-details/media-details.module.ts @@ -11,6 +11,7 @@ import { TvDetailsComponent } from "./tv/tv-details.component"; import { PipeModule } from "../pipes/pipe.module"; import { YoutubeTrailerComponent } from "./youtube-trailer.component"; import { MovieInformationPanelComponent } from "./movie/panels/movie-information-panel.component"; +import { TvInformationPanelComponent } from "./tv/panels/tv-information-panel.component"; const routes: Routes = [ { path: "movie/:movieDbId", component: MovieDetailsComponent }, @@ -29,6 +30,7 @@ const routes: Routes = [ YoutubeTrailerComponent, TvDetailsComponent, MovieInformationPanelComponent, + TvInformationPanelComponent, ], exports: [ RouterModule, diff --git a/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.html index ed5175c54..02fc5124e 100644 --- a/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.html @@ -67,6 +67,19 @@ + + + + + + + + + + + @@ -89,17 +102,9 @@ 'Common.Request' | translate }} - - - {{'Search.ViewOnPlex' | - translate}} - {{'Search.ViewOnEmby' | - translate}} - + + diff --git a/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.ts index b428419fb..dd871f3ce 100644 --- a/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/movie/movie-details.component.ts @@ -6,6 +6,7 @@ import { ISearchMovieResultV2 } from "../../interfaces/ISearchMovieResultV2"; import { MatDialog } from "@angular/material"; import { YoutubeTrailerComponent } from "../youtube-trailer.component"; import { AuthService } from "../../auth/auth.service"; +import { IMovieRequests } from "../../interfaces"; @Component({ templateUrl: "./movie-details.component.html", @@ -14,6 +15,8 @@ import { AuthService } from "../../auth/auth.service"; }) export class MovieDetailsComponent { public movie: ISearchMovieResultV2; + public hasRequest: boolean; + public movieRequest: IMovieRequests; public isAdmin: boolean; private theMovidDbId: number; @@ -30,8 +33,13 @@ export class MovieDetailsComponent { public load() { this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); - this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(x => { + this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => { this.movie = x; + if(this.movie.requestId > 0) { + // Load up this request + this.hasRequest = true; + this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId); + } this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => { this.movie.background = this.sanitizer.bypassSecurityTrustStyle ("url(" + x + ")"); @@ -41,7 +49,7 @@ export class MovieDetailsComponent { } public async request() { - var result = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: null }).toPromise(); + const result = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: null }).toPromise(); if (result.result) { this.movie.requested = true; this.messageService.send(result.message, "Ok"); @@ -56,4 +64,14 @@ export class MovieDetailsComponent { data: this.movie.videos.results[0].key }); } + + public async deny() { + const result = await this.requestService.denyMovie({id: this.theMovidDbId, reason: ""}).toPromise(); + if (result.result) { + this.movie.approved = false; + this.messageService.send(result.message, "Ok"); + } else { + this.messageService.send(result.errorMessage, "Ok"); + } + } } diff --git a/src/Ombi/ClientApp/src/app/media-details/movie/panels/movie-information-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/movie/panels/movie-information-panel.component.html index 1f9c02e18..359588028 100644 --- a/src/Ombi/ClientApp/src/app/media-details/movie/panels/movie-information-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/movie/panels/movie-information-panel.component.html @@ -1,62 +1,80 @@ -
- Genres: -
- - - {{genre.name}} - - -
-
-
-
+
Status:
{{movie.status}}
- Theatrical Release:
- {{movie.releaseDate | date: 'mediumDate'}} + Availability +
{{'Common.Available' | translate}}
+
{{'Common.NotAvailable' | translate}}
+
-
-
- Digital Release: +
- {{movie.digitalReleaseDate | date: 'mediumDate'}} + Request Status +
{{'Common.ProcessingRequest' | translate}}
+
{{'Common.PendingApproval' | translate}} +
+
{{'Common.NotRequested' | translate}} +
-
-
- User Score: -
- {{movie.voteAverage | number:'1.0-1'}} / 10 + +
+
+ Genres: +
+ + + {{genre.name}} + + +
-
-
- Votes: +
+ + Theatrical Release:
- {{movie.voteCount | thousandShort: 1}} -
-
-
- Runtime: -
{{movie.runtime}} Minutes
-
-
- Revenue: -
{{movie.revenue | currency: 'USD'}}
-
-
- Budget: -
{{movie.budget | currency: 'USD'}}
-
+ + {{movie.releaseDate | date: 'mediumDate'}} +
+ Digital Release: +
+ {{movie.digitalReleaseDate | date: 'mediumDate'}} +
+
+
+ User Score: +
+ {{movie.voteAverage | number:'1.0-1'}} / 10 +
+
+
+ Votes: +
+ {{movie.voteCount | thousandShort: 1}} +
+
+
+ Runtime: +
{{movie.runtime}} Minutes
+
+
+ Revenue: +
{{movie.revenue | currency: 'USD'}}
+
+
+ Budget: +
{{movie.budget | currency: 'USD'}}
+
-
-
- Keywords/Tags: - - - {{keyword.name}} - - -
\ No newline at end of file +
+
+ Keywords/Tags: + + + {{keyword.name}} + + +
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.html new file mode 100644 index 000000000..5c5844817 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.html @@ -0,0 +1,61 @@ +
+
+ Status: +
+ {{tv.status}} +
+
+ First Aired: +
+ {{tv.firstAired | date: 'mediumDate'}} +
+
+ + +
+ Status: +
+ {{tv.status}} +
+
+
+ Runtime: +
+ {{tv.runtime}} Minutes +
+
+
+ Rating: +
+ {{tv.rating}} / 10 +
+
+
+ Network: +
+ {{tv.network.name}} +
+
+ +
+ Genres: +
+ + {{genre}} | + +
+
+ +
+
+ Seasons: +
+ {{seasonCount}} +
+
+
+ Episodes: +
+ {{totalEpisodes}} +
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.ts b/src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.ts new file mode 100644 index 000000000..0981fbb31 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/tv/panels/tv-information-panel.component.ts @@ -0,0 +1,12 @@ +import { Component, ViewEncapsulation, Input } from "@angular/core"; +import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2"; + +@Component({ + templateUrl: "./tv-information-panel.component.html", + styleUrls: ["../../media-details.component.scss"], + selector: "tv-information-panel", + encapsulation: ViewEncapsulation.None +}) +export class TvInformationPanelComponent { + @Input() public tv: ISearchTvResultV2; +} diff --git a/src/Ombi/ClientApp/src/app/media-details/tv/tv-details.component.html b/src/Ombi/ClientApp/src/app/media-details/tv/tv-details.component.html index 39c6b7893..53c47b9c9 100644 --- a/src/Ombi/ClientApp/src/app/media-details/tv/tv-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/tv/tv-details.component.html @@ -79,57 +79,53 @@
-
+
- - -
- First Aired: - {{tv.firstAired | date: 'mediumDate'}}
- -
- Rating: {{tv.rating}}/10 -
-
- Status: {{tv.status}} -
-
- Runtime: {{tv.runtime}} Minutes -
-
- Status: {{tv.status}} -
-
- Network: {{tv.network.name}} -
- -
- Genres: - - {{genre}} | - - -
- - -
- Seasons: {{seasonCount}} -
-
- Episodes: {{totalEpisodes}} -
+ + + +
-
-
- - - {{tv.overview}} - - +
+
+
+ + + {{tv.overview}} + + +
+
+ + Cast + + + +
+
+ + +
+
+ Character: {{item.character.name}} +
+
+ Actor: {{item.person.name}} +
+
+
+
+
+
+
+ +
+
@@ -137,54 +133,10 @@
- -
- - - - -
-
- - Cast - - - -
-
- - -
-
- Character: {{item.character.name}} -
-
- Actor: {{item.person.name}} -
-
-
-
-
-
+
diff --git a/src/Ombi/ClientApp/src/app/search/moviesearch.component.html b/src/Ombi/ClientApp/src/app/search/moviesearch.component.html index c19815678..f28650932 100644 --- a/src/Ombi/ClientApp/src/app/search/moviesearch.component.html +++ b/src/Ombi/ClientApp/src/app/search/moviesearch.component.html @@ -101,10 +101,10 @@ class="label label-info" [translate]="'Search.Movies.Trailer'"> {{result.quality}}p - - + + + + (`${this.url}movie/search/${search}`, {headers: this.headers}); } + public getMovieRequest(requestId: number): Promise { + return this.http.get(`${this.url}movie/info/${requestId}`, {headers: this.headers}).toPromise(); + } + public removeMovieRequest(request: IMovieRequests) { this.http.delete(`${this.url}movie/${request.id}`, {headers: this.headers}).subscribe(); } diff --git a/src/Ombi/Controllers/V1/RequestController.cs b/src/Ombi/Controllers/V1/RequestController.cs index eb49d5962..537959eb5 100644 --- a/src/Ombi/Controllers/V1/RequestController.cs +++ b/src/Ombi/Controllers/V1/RequestController.cs @@ -56,6 +56,16 @@ namespace Ombi.Controllers.V1 }); } + /// + /// Returns information about the Single Movie Request + /// + /// the movie request id + [HttpGet("movie/info/{requestId}")] + public async Task GetMovieRequest(int requestId) + { + return await MovieRequestEngine.GetRequest(requestId); + } + /// /// Gets the total amount of movie requests. ///