From 947fe8308dcf5ae15385eba224ce9a7a95e78d82 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 30 Jan 2019 21:39:47 +0000 Subject: [PATCH] Lots of work on the movie details page !wip --- .../Search/V2/MovieFullInfoViewModel.cs | 9 +- src/Ombi.DependencyInjection/IocExtensions.cs | 2 + src/Ombi.Mapping/Profiles/MovieProfile.cs | 13 +- .../app/interfaces/ISearchMovieResultV2.ts | 6 +- .../app/media-details/media-details.module.ts | 5 + .../movie-details-trailer.component.html | 2 + .../movie-details-trailer.component.ts | 15 +++ .../movie-details.component.html | 112 ++++++++++++++++-- .../movie-details.component.scss | 24 +++- .../media-details/movie-details.component.ts | 13 +- src/Ombi/ClientApp/src/app/pipes/SafePipe.ts | 12 ++ .../ClientApp/src/app/pipes/pipe.module.ts | 5 +- .../src/app/services/searchV2.service.ts | 2 +- 13 files changed, 197 insertions(+), 23 deletions(-) create mode 100644 src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.html create mode 100644 src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.ts create mode 100644 src/Ombi/ClientApp/src/app/pipes/SafePipe.ts diff --git a/src/Ombi.Core/Models/Search/V2/MovieFullInfoViewModel.cs b/src/Ombi.Core/Models/Search/V2/MovieFullInfoViewModel.cs index 5f3c674f5..e22bfffc2 100644 --- a/src/Ombi.Core/Models/Search/V2/MovieFullInfoViewModel.cs +++ b/src/Ombi.Core/Models/Search/V2/MovieFullInfoViewModel.cs @@ -30,7 +30,7 @@ namespace Ombi.Core.Models.Search.V2 public string Homepage { get; set; } public int RootPathOverride { get; set; } public string Status { get; set; } - public List Videos { get; set; } + public Videos Videos { get; set; } public CreditsViewModel Credits { get; set; } public int QualityOverride { get; set; } public override RequestType Type => RequestType.Movie; @@ -54,7 +54,12 @@ namespace Ombi.Core.Models.Search.V2 public string origin_country { get; set; } } - public class VideoResults + public class Videos + { + public VideoResultsDetails[] results { get; set; } + } + + public class VideoResultsDetails { public string id { get; set; } public string iso_639_1 { get; set; } diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index 6392fe5c9..4d5ef6fd5 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -99,7 +99,9 @@ namespace Ombi.DependencyInjection public static void RegisterEnginesV2(this IServiceCollection services) { services.AddTransient(); + services.AddTransient(); } + public static void RegisterHttp(this IServiceCollection services) { services.AddSingleton(); diff --git a/src/Ombi.Mapping/Profiles/MovieProfile.cs b/src/Ombi.Mapping/Profiles/MovieProfile.cs index b11a9e1f7..930013599 100644 --- a/src/Ombi.Mapping/Profiles/MovieProfile.cs +++ b/src/Ombi.Mapping/Profiles/MovieProfile.cs @@ -1,4 +1,5 @@ -using AutoMapper; +using System.Collections.Generic; +using AutoMapper; using Ombi.Api.TheMovieDb.Models; using Ombi.Core.Models.Search; using Ombi.Core.Models.Search.V2; @@ -76,10 +77,14 @@ namespace Ombi.Mapping.Profiles CreateMap().ReverseMap(); CreateMap().ReverseMap(); - CreateMap().ReverseMap(); CreateMap().ReverseMap(); - CreateMap() - .ForMember(x => x.) + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISearchMovieResultV2.ts b/src/Ombi/ClientApp/src/app/interfaces/ISearchMovieResultV2.ts index edfb55877..cf6d2ff24 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISearchMovieResultV2.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISearchMovieResultV2.ts @@ -27,7 +27,7 @@ requestId: number; available: boolean; status: string; - videos: IVideoResult[]; + videos: IVideos; credits: ICreditsViewModel; releaseDates: IReleaseDatesDto; similar: IOtherMovies; @@ -45,6 +45,10 @@ background: any; } +export interface IVideos { + results: IVideoResult[]; +} + export interface IGenresViewModel { id: number; name: string; 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 193532263..659cebcef 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 @@ -6,6 +6,7 @@ import { SearchService } from "../services"; import { SharedModule } from "../shared/shared.module"; import { MovieDetailsComponent } from "./movie-details.component"; import { PipeModule } from "../pipes/pipe.module"; +import { MovieDetailsTrailerComponent } from "./movie-details-trailer.component"; const routes: Routes = [ { path: "movie/:movieDbId", component: MovieDetailsComponent }, @@ -18,10 +19,14 @@ const routes: Routes = [ ], declarations: [ MovieDetailsComponent, + MovieDetailsTrailerComponent ], exports: [ RouterModule, ], + entryComponents: [ + MovieDetailsTrailerComponent + ], providers: [ SearchService ], diff --git a/src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.html b/src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.html new file mode 100644 index 000000000..925ebc906 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.html @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.ts b/src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.ts new file mode 100644 index 000000000..bcebd3816 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/movie-details-trailer.component.ts @@ -0,0 +1,15 @@ +import { Component, Inject } from "@angular/core"; +import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material"; +import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2"; + +@Component({ + selector: "movie-trailer", + templateUrl: "./movie-details-trailer.component.html", +}) +export class MovieDetailsTrailerComponent { + + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: ISearchMovieResultV2) {} + +} diff --git a/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html index 73b80937d..8ac2f3bac 100644 --- a/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/movie-details.component.html @@ -9,9 +9,11 @@
-

{{movie.title}} ({{movie.releaseDate +

{{movie.title}} ({{movie.releaseDate | date:'yyyy'}})

+ +
{{movie.tagline}}

@@ -22,7 +24,7 @@