increased the load on discover

This commit is contained in:
Jamie Rees 2020-05-18 22:23:44 +01:00
commit 5a4c7d7893
3 changed files with 32 additions and 30 deletions

View file

@ -35,6 +35,8 @@ export class DiscoverComponent implements OnInit {
public loadingFlag: boolean; public loadingFlag: boolean;
public scrollDisabled: boolean; public scrollDisabled: boolean;
private amountToLoad = 14;
private contentLoaded: number; private contentLoaded: number;
private isScrolling: boolean = false; private isScrolling: boolean = false;
private mediaTypeStorageKey = "DiscoverOptions"; private mediaTypeStorageKey = "DiscoverOptions";
@ -51,14 +53,14 @@ export class DiscoverComponent implements OnInit {
this.scrollDisabled = true; this.scrollDisabled = true;
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.popularMoviesByPage(0, 12); this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad);
this.tvShows = await this.searchService.popularTvByPage(0, 12); this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.popularMoviesByPage(0, 12); this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.popularTvByPage(0, 12); this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad);
break; break;
} }
@ -78,42 +80,42 @@ export class DiscoverComponent implements OnInit {
if (this.popularActive) { if (this.popularActive) {
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.popularMoviesByPage(this.contentLoaded, 12); this.movies = await this.searchService.popularMoviesByPage(this.contentLoaded, this.amountToLoad);
this.tvShows = await this.searchService.popularTvByPage(this.contentLoaded, 12); this.tvShows = await this.searchService.popularTvByPage(this.contentLoaded, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.popularMoviesByPage(this.contentLoaded, 12); this.movies = await this.searchService.popularMoviesByPage(this.contentLoaded, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.popularTvByPage(this.contentLoaded, 12); this.tvShows = await this.searchService.popularTvByPage(this.contentLoaded, this.amountToLoad);
break; break;
} }
} }
if (this.trendingActive) { if (this.trendingActive) {
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.nowPlayingMoviesByPage(this.contentLoaded, 12); this.movies = await this.searchService.nowPlayingMoviesByPage(this.contentLoaded, this.amountToLoad);
this.tvShows = await this.searchService.trendingTvByPage(this.contentLoaded, 12); this.tvShows = await this.searchService.trendingTvByPage(this.contentLoaded, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.nowPlayingMoviesByPage(this.contentLoaded, 12); this.movies = await this.searchService.nowPlayingMoviesByPage(this.contentLoaded, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.trendingTvByPage(this.contentLoaded, 12); this.tvShows = await this.searchService.trendingTvByPage(this.contentLoaded, this.amountToLoad);
break; break;
} }
} }
if (this.upcomingActive) { if (this.upcomingActive) {
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.upcomingMoviesByPage(this.contentLoaded, 12); this.movies = await this.searchService.upcomingMoviesByPage(this.contentLoaded, this.amountToLoad);
this.tvShows = await this.searchService.anticipatedTvByPage(this.contentLoaded, 12); this.tvShows = await this.searchService.anticipatedTvByPage(this.contentLoaded, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.upcomingMoviesByPage(this.contentLoaded, 12); this.movies = await this.searchService.upcomingMoviesByPage(this.contentLoaded, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.anticipatedTvByPage(this.contentLoaded, 12); this.tvShows = await this.searchService.anticipatedTvByPage(this.contentLoaded, this.amountToLoad);
break; break;
} }
} }
@ -135,14 +137,14 @@ export class DiscoverComponent implements OnInit {
this.upcomingActive = false; this.upcomingActive = false;
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.popularMoviesByPage(0, 12); this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad);
this.tvShows = await this.searchService.popularTvByPage(0, 12); this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.popularMoviesByPage(0, 12); this.movies = await this.searchService.popularMoviesByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.popularTvByPage(0, 12); this.tvShows = await this.searchService.popularTvByPage(0, this.amountToLoad);
break; break;
} }
@ -162,14 +164,14 @@ export class DiscoverComponent implements OnInit {
this.upcomingActive = false; this.upcomingActive = false;
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.nowPlayingMoviesByPage(0, 12); this.movies = await this.searchService.nowPlayingMoviesByPage(0, this.amountToLoad);
this.tvShows = await this.searchService.trendingTvByPage(0, 12); this.tvShows = await this.searchService.trendingTvByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.nowPlayingMoviesByPage(0, 12); this.movies = await this.searchService.nowPlayingMoviesByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.trendingTvByPage(0, 12); this.tvShows = await this.searchService.trendingTvByPage(0, this.amountToLoad);
break; break;
} }
@ -188,14 +190,14 @@ export class DiscoverComponent implements OnInit {
this.upcomingActive = true; this.upcomingActive = true;
switch (this.discoverOptions) { switch (this.discoverOptions) {
case DiscoverOption.Combined: case DiscoverOption.Combined:
this.movies = await this.searchService.upcomingMoviesByPage(0, 12); this.movies = await this.searchService.upcomingMoviesByPage(0, this.amountToLoad);
this.tvShows = await this.searchService.anticipatedTvByPage(0, 12); this.tvShows = await this.searchService.anticipatedTvByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Movie: case DiscoverOption.Movie:
this.movies = await this.searchService.upcomingMoviesByPage(0, 12); this.movies = await this.searchService.upcomingMoviesByPage(0, this.amountToLoad);
break; break;
case DiscoverOption.Tv: case DiscoverOption.Tv:
this.tvShows = await this.searchService.anticipatedTvByPage(0, 12); this.tvShows = await this.searchService.anticipatedTvByPage(0, this.amountToLoad);
break; break;
} }

View file

@ -2,7 +2,7 @@
import { IEmbyServer, IEmbySettings } from "../../interfaces"; import { IEmbyServer, IEmbySettings } from "../../interfaces";
import { EmbyService, JobService, NotificationService, SettingsService, TesterService } from "../../services"; import { EmbyService, JobService, NotificationService, SettingsService, TesterService } from "../../services";
import { MatTabChangeEvent, MatTabGroup } from "@angular/material"; import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs";
import {FormControl} from '@angular/forms'; import {FormControl} from '@angular/forms';
@Component({ @Component({

View file

@ -4,7 +4,7 @@ import { takeUntil } from "rxjs/operators";
import { IPlexLibrariesSettings, IPlexServer, IPlexServerResponse, IPlexServerViewModel, IPlexSettings } from "../../interfaces"; import { IPlexLibrariesSettings, IPlexServer, IPlexServerResponse, IPlexServerViewModel, IPlexSettings } from "../../interfaces";
import { JobService, NotificationService, PlexService, SettingsService, TesterService } from "../../services"; import { JobService, NotificationService, PlexService, SettingsService, TesterService } from "../../services";
import { MatTabChangeEvent, MatTabGroup } from "@angular/material"; import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs";
import {FormControl} from '@angular/forms'; import {FormControl} from '@angular/forms';
@Component({ @Component({