!wip on the TV show

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

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

@ -42,49 +42,46 @@
<i class='fa fa-film no-search-results-icon'></i> <i class='fa fa-film no-search-results-icon'></i>
<div class='no-search-results-text'>{{ 'Search.NoResults' | translate }}</div> <div class='no-search-results-text'>{{ 'Search.NoResults' | translate }}</div>
</div> </div>
<p-treeTable [value]="tvResults"> <div >
<ng-template let-col let-node="rowData" pTemplate="header"> <div *ngFor="let node of tvResults">
{{ 'Search.TvShows.Results' | translate }}
</ng-template>
<ng-template let-col let-node="rowData" pTemplate="body">
<!--This is the section that holds the parent level search results set--> <!--This is the section that holds the parent level search results set-->
<div *ngIf="!node.leaf"> <div *ngIf="node">
<div class="row"> <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="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"> <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>
<div class="col-sm-8 small-padding"> <div class="col-sm-8 small-padding">
<div> <div>
<a *ngIf="node.data.imdbId" href="{{node.data.imdbId}}" target="_blank"> <a *ngIf="node.imdbId" href="{{node.imdbId}}" target="_blank">
<h4>{{node.data.title}} ({{node.data.firstAired | date: 'yyyy'}})</h4> <h4>{{node.title}} ({{node.firstAired | date: 'yyyy'}})</h4>
</a> </a>
<span class="tags"> <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> <span class="label label-info">{{ 'Search.Movies.HomePage' | translate }}</span>
</a> </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> <span class="label label-info">{{ 'Search.Movies.Trailer' | translate }}</span>
</a> </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 />
<br /> <br />
</div> </div>
<p class="tv-overview">{{node.data.overview}}</p> <p class="tv-overview">{{node.overview}}</p>
</div> </div>
<div class="col-sm-2 small-padding"> <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"> <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 }} <i class="fa fa-plus"></i> {{ 'Common.Request' | translate }}
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li> <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>
<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>
<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>
<li> <li>
<a href="#" (click)="openClosestTab($event)">{{ 'Search.TvShows.Select' | translate }}</a> <a href="#" (click)="openClosestTab($event)">{{ 'Search.TvShows.Select' | translate }}</a>
@ -119,19 +116,19 @@
</ul> </ul>
</div> </div>
<div *ngIf="node.data.fullyAvailable"> <div *ngIf="node.fullyAvailable">
<button style="text-align: right" class="btn btn-success-outline disabled" disabled> <button style="text-align: right" class="btn btn-success-outline disabled" disabled>
<i class="fa fa-check"></i> {{ 'Common.Available' | translate }} <i class="fa fa-check"></i> {{ 'Common.Available' | translate }}
</button> </button>
</div> </div>
<br /> <br />
<div *ngIf="node.data.plexUrl && node.data.available"> <div *ngIf="node.plexUrl && node.available">
<a style="text-align: right" class="btn btn-sm btn-success-outline" href="{{node.data.plexUrl}}" target="_blank"> <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 }} <i class="fa fa-eye"></i> {{ 'Search.ViewOnPlex' | translate }}
</a> </a>
</div> </div>
<div *ngIf="node.data.embyUrl && node.data.available"> <div *ngIf="node.embyUrl && node.available">
<a style="text-align: right" id="embybtn" class="btn btn-sm btn-success-outline" href="{{node.data.embyUrl}}" target="_blank"> <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 }} <i class="fa fa-eye"></i> {{ 'Search.ViewOnEmby' | translate }}
</a> </a>
</div> </div>
@ -143,11 +140,11 @@
</button> </button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li *ngFor="let cat of issueCategories"> <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> </li>
</ul> </ul>
</div> </div>
<div *ngIf="!node.data.available"> <div *ngIf="!node.available">
<br /> <br />
<br /> <br />
</div> </div>
@ -158,7 +155,7 @@
</div> </div>
<!--This is the section that holds the child seasons if they want to specify specific episodes--> <!--This is the section that holds the child seasons if they want to specify specific episodes-->
<div *ngIf="node.leaf"> <div *ngIf="node.leaf">
<seriesinformation [seriesId]="node.data.id"></seriesinformation> <seriesinformation [seriesId]="node.id"></seriesinformation>
</div> </div>
<br/> <br/>

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

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

Loading…
Cancel
Save