From 878adc5febf3c8446439fa349a86392d82a282c5 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 31 Dec 2020 23:54:05 +0000 Subject: [PATCH] poc --- src/Ombi.Core/Engine/RecentlyAddedEngine.cs | 2 + .../discover/discover.component.html | 18 +++- .../discover/discover.component.scss | 5 +- .../components/discover/discover.component.ts | 95 ++++++++++--------- .../src/app/discover/components/index.ts | 2 + .../movie-list/movie-list.component.html | 23 +++++ .../movie-list/movie-list.component.scss | 58 +++++++++++ .../movie-list/movie-list.component.ts | 85 +++++++++++++++++ .../src/app/discover/discover.module.ts | 2 + .../tv-requests-panel.component.html | 2 +- src/Ombi/ClientApp/src/styles/buttons.scss | 8 +- 11 files changed, 247 insertions(+), 53 deletions(-) create mode 100644 src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.html create mode 100644 src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.scss create mode 100644 src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.ts diff --git a/src/Ombi.Core/Engine/RecentlyAddedEngine.cs b/src/Ombi.Core/Engine/RecentlyAddedEngine.cs index 114d32a24..e7491ff39 100644 --- a/src/Ombi.Core/Engine/RecentlyAddedEngine.cs +++ b/src/Ombi.Core/Engine/RecentlyAddedEngine.cs @@ -24,6 +24,8 @@ namespace Ombi.Core.Engine private readonly IEmbyContentRepository _emby; private readonly IRepository _recentlyAddedLog; + + public IEnumerable GetRecentlyAddedMovies(DateTime from, DateTime to) { var plexMovies = _plex.GetAll().Where(x => x.Type == PlexMediaTypeEntity.Movie && x.AddedAt > from && x.AddedAt < to); diff --git a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html index f105b23ab..f51f73ede 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.html @@ -1,5 +1,5 @@
-
+ -
+ + +

Upcoming Movies

+
+ +
+ +

Trending Movies

+
+
-
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.scss b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.scss index c2386ae8f..9c11beab7 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.scss +++ b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.scss @@ -5,6 +5,7 @@ .small-middle-container { margin: auto; width: 85%; + padding-left:2%; } .small-padding { @@ -35,6 +36,8 @@ ::ng-deep .mat-card-image { height: 75%; + border-radius: 10px; + width: 100%; object-fit: cover; display: block; } @@ -207,4 +210,4 @@ .discover-layout{ display: none; } -} \ No newline at end of file +} diff --git a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts index c42a0417d..74837f7af 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/discover/discover.component.ts @@ -20,6 +20,10 @@ import { DOCUMENT } from "@angular/common"; }) export class DiscoverComponent implements OnInit { + public upcomingMovies: IDiscoverCardResult[] = []; + public trendingMovies: IDiscoverCardResult[] = []; + + public discoverResults: IDiscoverCardResult[] = []; public movies: ISearchMovieResult[] = []; public tvShows: ISearchTvResult[] = []; @@ -45,6 +49,8 @@ export class DiscoverComponent implements OnInit { private mediaTypeStorageKey = "DiscoverOptions"; private displayOptionsKey = "DiscoverDisplayOptions"; + + constructor(private searchService: SearchV2Service, private storageService: StorageService, @Inject(DOCUMENT) private container: Document) { } @@ -52,35 +58,38 @@ export class DiscoverComponent implements OnInit { public async ngOnInit() { this.loading() - const localDiscoverOptions = +this.storageService.get(this.mediaTypeStorageKey); - if (localDiscoverOptions) { - this.discoverOptions = DiscoverOption[DiscoverOption[localDiscoverOptions]]; - } - const localDisplayOptions = +this.storageService.get(this.displayOptionsKey); - if (localDisplayOptions) { - this.displayOption = DisplayOption[DisplayOption[localDisplayOptions]]; - } - this.scrollDisabled = true; - switch (this.discoverOptions) { - case DiscoverOption.Combined: - this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad); - this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad); - break; - case DiscoverOption.Movie: - this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad); - break; - case DiscoverOption.Tv: - this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad); - break; - } - - this.contentLoaded = this.amountToLoad; - - this.createInitialModel(); - this.scrollDisabled = false; - if (!this.containerHasScrollBar()) { - await this.onScroll(); - } + this.upcomingMovies = this.mapMovieModel(await this.searchService.upcomingMoviesByPage(0, 14)); + this.trendingMovies = this.mapMovieModel(await this.searchService.popularMoviesByPage(0, 14)); +this.finishLoading(); + // const localDiscoverOptions = +this.storageService.get(this.mediaTypeStorageKey); + // if (localDiscoverOptions) { + // this.discoverOptions = DiscoverOption[DiscoverOption[localDiscoverOptions]]; + // } + // const localDisplayOptions = +this.storageService.get(this.displayOptionsKey); + // if (localDisplayOptions) { + // this.displayOption = DisplayOption[DisplayOption[localDisplayOptions]]; + // } + // this.scrollDisabled = true; + // switch (this.discoverOptions) { + // case DiscoverOption.Combined: + // this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad); + // this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad); + // break; + // case DiscoverOption.Movie: + // this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad); + // break; + // case DiscoverOption.Tv: + // this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad); + // break; + // } + + // this.contentLoaded = this.amountToLoad; + + // this.createInitialModel(); + // this.scrollDisabled = false; + // if (!this.containerHasScrollBar()) { + // await this.onScroll(); + // } } public async onScroll() { @@ -236,18 +245,18 @@ export class DiscoverComponent implements OnInit { private createModel() { const tempResults = []; - switch (this.discoverOptions) { - case DiscoverOption.Combined: - tempResults.push(...this.mapMovieModel()); - tempResults.push(...this.mapTvModel()); - break; - case DiscoverOption.Movie: - tempResults.push(...this.mapMovieModel()); - break; - case DiscoverOption.Tv: - tempResults.push(...this.mapTvModel()); - break; - } + // switch (this.discoverOptions) { + // case DiscoverOption.Combined: + // tempResults.push(...this.mapMovieModel()); + // tempResults.push(...this.mapTvModel()); + // break; + // case DiscoverOption.Movie: + // tempResults.push(...this.mapMovieModel()); + // break; + // case DiscoverOption.Tv: + // tempResults.push(...this.mapTvModel()); + // break; + // } this.shuffle(tempResults); this.discoverResults.push(...tempResults); @@ -255,9 +264,9 @@ export class DiscoverComponent implements OnInit { this.finishLoading(); } - private mapMovieModel(): IDiscoverCardResult[] { + private mapMovieModel(movies: ISearchMovieResult[]): IDiscoverCardResult[] { const tempResults = []; - this.movies.forEach(m => { + movies.forEach(m => { tempResults.push({ available: m.available, posterPath: m.posterPath ? `https://image.tmdb.org/t/p/w500/${m.posterPath}` : "../../../images/default_movie_poster.png", diff --git a/src/Ombi/ClientApp/src/app/discover/components/index.ts b/src/Ombi/ClientApp/src/app/discover/components/index.ts index e65e48bd3..22dd0b208 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/index.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/index.ts @@ -8,6 +8,7 @@ import { AuthGuard } from "../../auth/auth.guard"; import { SearchService, RequestService } from "../../services"; import { MatDialog } from "@angular/material/dialog"; import { DiscoverGridComponent } from "./grid/discover-grid.component"; +import { MovieListComponent } from "./movie-list/movie-list.component"; export const components: any[] = [ @@ -17,6 +18,7 @@ export const components: any[] = [ DiscoverCollectionsComponent, DiscoverActorComponent, DiscoverGridComponent, + MovieListComponent, ]; diff --git a/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.html b/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.html new file mode 100644 index 000000000..d37f21d0a --- /dev/null +++ b/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.html @@ -0,0 +1,23 @@ + + +
+
+ {{result.title}} +
{{RequestType[result.type] | humanize}}
+
+
{{result.title}}
+
{{result.overview | truncate: 80}}
+
+
+ +
+
+ +
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.scss b/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.scss new file mode 100644 index 000000000..b45393718 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.scss @@ -0,0 +1,58 @@ + + +.ombi-card { + padding: 5px; +} +::ng-deep .p-carousel-indicators { + display: none !important; + } + + +.image { + border-radius: 10px; + opacity: 1; + display: block; + width: 100%; + height: auto; + transition: .5s ease; + backface-visibility: hidden; + } + + +.middle { + transition: .5s ease; + opacity: 0; + position: absolute; + top: 75%; + width: 90%; + left: 50%; + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + } + + + .c { + position: relative; + } + +.c:hover .image { + opacity: 0.3; + } + + .c:hover .middle { + opacity: 1; + } + +.small-text { + font-size: 11px; + } + .title { + font-size: 16px; + } + .top-left { + font-size: 14px; + position: absolute; + top: 8px; + left: 16px; + + } \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.ts b/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.ts new file mode 100644 index 000000000..a58ca6aa6 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/discover/components/movie-list/movie-list.component.ts @@ -0,0 +1,85 @@ +import { Component, OnInit, Input } from "@angular/core"; +import { IDiscoverCardResult } from "../../interfaces"; +import { RequestType} from "../../../interfaces"; +import { SearchV2Service } from "../../../services"; +import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2"; +import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2"; + +@Component({ + selector: "movie-list", + templateUrl: "./movie-list.component.html", + styleUrls: ["./movie-list.component.scss"], +}) +export class MovieListComponent implements OnInit { + + public RequestType = RequestType; + @Input() public result: IDiscoverCardResult; + + constructor(private searchService: SearchV2Service) { } + + public ngOnInit() { + if (this.result.type == RequestType.tvShow) { + this.getExtraTvInfo(); + } + if (this.result.type == RequestType.movie) { + this.getExtraMovieInfo(); + } + } + + + public async getExtraTvInfo() { + var result = await this.searchService.getTvInfo(this.result.id); + this.setTvDefaults(result); + this.updateTvItem(result); + + } + + public getStatusClass(): string { + if (this.result.available) { + return "available"; + } + if (this.result.approved) { + return "approved"; + } + if (this.result.requested) { + return "requested"; + } + return "notrequested"; + } + + private getExtraMovieInfo() { + if (!this.result.imdbid) { + this.searchService.getFullMovieDetails(this.result.id) + .subscribe(m => { + this.updateMovieItem(m); + }); + } + } + + private updateMovieItem(updated: ISearchMovieResultV2) { + this.result.url = "http://www.imdb.com/title/" + updated.imdbId + "/"; + this.result.available = updated.available; + this.result.requested = updated.requested; + this.result.requested = updated.requestProcessing; + this.result.rating = updated.voteAverage; + } + + + private setTvDefaults(x: ISearchTvResultV2) { + if (!x.imdbId) { + x.imdbId = "https://www.tvmaze.com/shows/" + x.seriesId; + } else { + x.imdbId = "http://www.imdb.com/title/" + x.imdbId + "/"; + } + } + + private updateTvItem(updated: ISearchTvResultV2) { + this.result.title = updated.title; + this.result.id = updated.id; + this.result.available = updated.fullyAvailable; + this.result.posterPath = updated.banner; + this.result.requested = updated.requested; + this.result.url = updated.imdbId; + } + +} diff --git a/src/Ombi/ClientApp/src/app/discover/discover.module.ts b/src/Ombi/ClientApp/src/app/discover/discover.module.ts index e40cf102a..19882a5e6 100644 --- a/src/Ombi/ClientApp/src/app/discover/discover.module.ts +++ b/src/Ombi/ClientApp/src/app/discover/discover.module.ts @@ -5,6 +5,7 @@ import {MatButtonToggleModule} from '@angular/material/button-toggle'; import { SharedModule } from "../shared/shared.module"; import { PipeModule } from "../pipes/pipe.module"; +import {CarouselModule} from 'primeng/carousel'; import * as fromComponents from './components'; @@ -14,6 +15,7 @@ import * as fromComponents from './components'; RouterModule.forChild(fromComponents.routes), SharedModule, PipeModule, + CarouselModule, MatButtonToggleModule, InfiniteScrollModule, ], diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html index 661c11e86..b45d9cc7a 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html @@ -50,7 +50,7 @@ -
diff --git a/src/Ombi/ClientApp/src/styles/buttons.scss b/src/Ombi/ClientApp/src/styles/buttons.scss index c9b94cabf..49b98fdee 100644 --- a/src/Ombi/ClientApp/src/styles/buttons.scss +++ b/src/Ombi/ClientApp/src/styles/buttons.scss @@ -5,17 +5,17 @@ $green:#1DE9B6; $orange:#F57C00; .btn-blue { - background-color: $blue; + background-color: $blue !important; } .btn-pink { - background-color: $pink; + background-color: $pink !important; } .btn-green { - background-color: $green; + background-color: $green !important; } .btn-orange { - background-color: $orange; + background-color: $orange !important; } \ No newline at end of file