!wip on the TV show

pull/2411/head
TidusJar 6 years ago
parent 375208703e
commit 2da1272ab8

@ -28,8 +28,15 @@ export interface ISearchTvResult {
available: boolean;
plexUrl: string;
embyUrl: string;
quality: string;
firstSeason: boolean;
latestSeason: boolean;
theTvDbId: string;
subscribed: boolean;
showSubscribe: boolean;
fullyAvailable: boolean;
partlyAvailable: boolean;
background: any;
}
export interface ITvRequestViewModel {

@ -42,49 +42,46 @@
<i class='fa fa-film no-search-results-icon'></i>
<div class='no-search-results-text'>{{ 'Search.NoResults' | translate }}</div>
</div>
<p-treeTable [value]="tvResults">
<ng-template let-col let-node="rowData" pTemplate="header">
{{ 'Search.TvShows.Results' | translate }}
</ng-template>
<ng-template let-col let-node="rowData" pTemplate="body">
<div >
<div *ngFor="let node of tvResults">
<!--This is the section that holds the parent level search results set-->
<div *ngIf="!node.leaf">
<div *ngIf="node">
<div class="row">
<div class="myBg backdrop" [style.background-image]="node?.data?.background"></div>
<div class="myBg backdrop" [style.background-image]="node?.background"></div>
<div class="tint" style="background-image: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%,rgba(0,0,0,0.6) 100%);"></div>
<div class="col-sm-2 small-padding">
<img *ngIf="node?.data?.banner" class="img-responsive poster" width="150" [src]="node.data.banner" alt="poster">
<img *ngIf="node?.banner" class="img-responsive poster" width="150" [src]="node.banner" alt="poster">
</div>
<div class="col-sm-8 small-padding">
<div>
<a *ngIf="node.data.imdbId" href="{{node.data.imdbId}}" target="_blank">
<h4>{{node.data.title}} ({{node.data.firstAired | date: 'yyyy'}})</h4>
<a *ngIf="node.imdbId" href="{{node.imdbId}}" target="_blank">
<h4>{{node.title}} ({{node.firstAired | date: 'yyyy'}})</h4>
</a>
<span class="tags">
<a *ngIf="node.data.homepage" id="homepageLabel" href="{{node.data.homepage}}" target="_blank">
<a *ngIf="node.homepage" id="homepageLabel" href="{{node.homepage}}" target="_blank">
<span class="label label-info">{{ 'Search.Movies.HomePage' | translate }}</span>
</a>
<a *ngIf="node.data.trailer" id="trailerLabel" href="{{node.data.trailer}}" target="_blank">
<a *ngIf="node.trailer" id="trailerLabel" href="{{node.trailer}}" target="_blank">
<span class="label label-info">{{ 'Search.Movies.Trailer' | translate }}</span>
</a>
<span *ngIf="node.data.status" class="label label-primary" id="statusLabel" target="_blank">{{node.data.status}}</span>
<span *ngIf="node.status" class="label label-primary" id="statusLabel" target="_blank">{{node.status}}</span>
<span *ngIf="node.data.firstAired" class="label label-info" target="_blank" id="airDateLabel">{{ 'Search.TvShows.AirDate' | translate }} {{node.data.firstAired | date: 'dd/MM/yyyy'}}</span>
<span *ngIf="node.firstAired" class="label label-info" target="_blank" id="airDateLabel">{{ 'Search.TvShows.AirDate' | translate }} {{node.firstAired | date: 'dd/MM/yyyy'}}</span>
<span *ngIf="node.data.network" class="label label-info" id="networkLabel" target="_blank">{{node.data.network}}</span>
<span *ngIf="node.network" class="label label-info" id="networkLabel" target="_blank">{{node.network}}</span>
<span *ngIf="node.data.available" class="label label-success" id="availableLabel">{{ 'Common.Available' | translate }}</span>
<span *ngIf="node.available" class="label label-success" id="availableLabel">{{ 'Common.Available' | translate }}</span>
<span *ngIf="node.data.partlyAvailable" class="label label-warning" id="partiallyAvailableLabel">{{ 'Common.PartlyAvailable' | translate }}</span>
<span *ngIf="node.partlyAvailable" class="label label-warning" id="partiallyAvailableLabel">{{ 'Common.PartlyAvailable' | translate }}</span>
@ -93,25 +90,25 @@
<br />
<br />
</div>
<p class="tv-overview">{{node.data.overview}}</p>
<p class="tv-overview">{{node.overview}}</p>
</div>
<div class="col-sm-2 small-padding">
<div *ngIf="!node.data.fullyAvailable" class="dropdown">
<div *ngIf="!node.fullyAvailable" class="dropdown">
<button class="btn btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus"></i> {{ 'Common.Request' | translate }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>
<a href="#" (click)="allSeasons(node.data, $event)">{{ 'Search.TvShows.AllSeasons' | translate }}</a>
<a href="#" (click)="allSeasons(node, $event)">{{ 'Search.TvShows.AllSeasons' | translate }}</a>
</li>
<li>
<a href="#" (click)="firstSeason(node.data, $event)">{{ 'Search.TvShows.FirstSeason' | translate }}</a>
<a href="#" (click)="firstSeason(node, $event)">{{ 'Search.TvShows.FirstSeason' | translate }}</a>
</li>
<li>
<a href="#" (click)="latestSeason(node.data, $event)">{{ 'Search.TvShows.LatestSeason' | translate }}</a>
<a href="#" (click)="latestSeason(node, $event)">{{ 'Search.TvShows.LatestSeason' | translate }}</a>
</li>
<li>
<a href="#" (click)="openClosestTab($event)">{{ 'Search.TvShows.Select' | translate }}</a>
@ -119,19 +116,19 @@
</ul>
</div>
<div *ngIf="node.data.fullyAvailable">
<div *ngIf="node.fullyAvailable">
<button style="text-align: right" class="btn btn-success-outline disabled" disabled>
<i class="fa fa-check"></i> {{ 'Common.Available' | translate }}
</button>
</div>
<br />
<div *ngIf="node.data.plexUrl && node.data.available">
<a style="text-align: right" class="btn btn-sm btn-success-outline" href="{{node.data.plexUrl}}" target="_blank">
<div *ngIf="node.plexUrl && node.available">
<a style="text-align: right" class="btn btn-sm btn-success-outline" href="{{node.plexUrl}}" target="_blank">
<i class="fa fa-eye"></i> {{ 'Search.ViewOnPlex' | translate }}
</a>
</div>
<div *ngIf="node.data.embyUrl && node.data.available">
<a style="text-align: right" id="embybtn" class="btn btn-sm btn-success-outline" href="{{node.data.embyUrl}}" target="_blank">
<div *ngIf="node.embyUrl && node.available">
<a style="text-align: right" id="embybtn" class="btn btn-sm btn-success-outline" href="{{node.embyUrl}}" target="_blank">
<i class="fa fa-eye"></i> {{ 'Search.ViewOnEmby' | translate }}
</a>
</div>
@ -143,11 +140,11 @@
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let cat of issueCategories">
<a [routerLink]="" (click)="reportIssue(cat, node.data)">{{cat.value}}</a>
<a [routerLink]="" (click)="reportIssue(cat, node)">{{cat.value}}</a>
</li>
</ul>
</div>
<div *ngIf="!node.data.available">
<div *ngIf="!node.available">
<br />
<br />
</div>
@ -158,7 +155,7 @@
</div>
<!--This is the section that holds the child seasons if they want to specify specific episodes-->
<div *ngIf="node.leaf">
<seriesinformation [seriesId]="node.data.id"></seriesinformation>
<seriesinformation [seriesId]="node.id"></seriesinformation>
</div>
<br/>

@ -1,7 +1,6 @@
import { PlatformLocation } from "@angular/common";
import { Component, Input, OnInit } from "@angular/core";
import { DomSanitizer } from "@angular/platform-browser";
import { TreeNode } from "primeng/primeng";
import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
@ -18,7 +17,7 @@ export class TvSearchComponent implements OnInit {
public searchText: string;
public searchChanged = new Subject<string>();
public tvResults: TreeNode[];
public tvResults: ISearchTvResult[];
public result: IRequestEngineResult;
public searchApplied = false;
public defaultPoster: string;
@ -46,7 +45,7 @@ export class TvSearchComponent implements OnInit {
this.clearResults();
return;
}
this.searchService.searchTvTreeNode(this.searchText)
this.searchService.searchTv(this.searchText)
.subscribe(x => {
this.tvResults = x;
this.searchApplied = true;
@ -138,14 +137,14 @@ export class TvSearchComponent implements OnInit {
public getExtraInfo() {
this.tvResults.forEach((val, index) => {
this.imageService.getTvBanner(val.data.id).subscribe(x => {
this.imageService.getTvBanner(val.id).subscribe(x => {
if (x) {
val.data.background = this.sanitizer.
val.background = this.sanitizer.
bypassSecurityTrustStyle
("url(" + x + ")");
}
});
this.searchService.getShowInformationTreeNode(val.data.id)
this.searchService.getShowInformation(val.id)
.subscribe(x => {
if (x.data) {
this.setDefaults(x);
@ -223,17 +222,17 @@ export class TvSearchComponent implements OnInit {
this.issueProviderId = req.id.toString();
}
private updateItem(key: TreeNode, updated: TreeNode) {
private updateItem(key: ISearchTvResult, updated: ISearchTvResult) {
const index = this.tvResults.indexOf(key, 0);
if (index > -1) {
// Update certain properties, otherwise we will loose some data
this.tvResults[index].data.title = updated.data.title;
this.tvResults[index].data.banner = updated.data.banner;
this.tvResults[index].data.imdbId = updated.data.imdbId;
this.tvResults[index].data.seasonRequests = updated.data.seasonRequests;
this.tvResults[index].data.seriesId = updated.data.seriesId;
this.tvResults[index].data.fullyAvailable = updated.data.fullyAvailable;
this.tvResults[index].data.backdrop = updated.data.backdrop;
this.tvResults[index].title = updated.title;
this.tvResults[index].banner = updated.banner;
this.tvResults[index].imdbId = updated.imdbId;
this.tvResults[index].seasonRequests = updated.seasonRequests;
this.tvResults[index].seriesId = updated.seriesId;
this.tvResults[index].fullyAvailable = updated.fullyAvailable;
this.tvResults[index].background = updated.banner;
}
}

@ -56,16 +56,16 @@ export class SearchService extends ServiceHelpers {
return this.http.get<ISearchTvResult>(`${this.url}/Tv/info/${theTvDbId}`, {headers: this.headers});
}
public popularTv(): Observable<TreeNode[]> {
return this.http.get<TreeNode[]>(`${this.url}/Tv/popular/tree`, {headers: this.headers});
public popularTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/popular`, {headers: this.headers});
}
public mostWatchedTv(): Observable<TreeNode[]> {
return this.http.get<TreeNode[]>(`${this.url}/Tv/mostwatched/tree`, {headers: this.headers});
public mostWatchedTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/mostwatched`, {headers: this.headers});
}
public anticipatedTv(): Observable<TreeNode[]> {
return this.http.get<TreeNode[]>(`${this.url}/Tv/anticipated/tree`, {headers: this.headers});
public anticipatedTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/anticipated`, {headers: this.headers});
}
public trendingTv(): Observable<TreeNode[]> {
return this.http.get<TreeNode[]>(`${this.url}/Tv/trending/tree`, {headers: this.headers});
public trendingTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending`, {headers: this.headers});
}
}

@ -11,7 +11,7 @@
"noUnusedLocals": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"alwaysStrict": true,
"emitDecoratorMetadata": true,

Loading…
Cancel
Save