From 11d4c0eba1e665cbab07b918b27877bc1715cd79 Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 14:38:33 -0700 Subject: [PATCH 01/15] Item 1) on issue #2124 --- .../tvrequest-children.component.html | 15 +--- .../requests/tvrequest-children.component.ts | 16 +---- .../app/requests/tvrequests.component.html | 72 +++++++++++-------- .../app/requests/tvrequests.component.ts | 12 +++- 4 files changed, 55 insertions(+), 60 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html index 30e1398eb..736878d4b 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html @@ -22,15 +22,7 @@ - + @@ -101,8 +93,3 @@

{{ 'Requests.Season' | translate }} {{season.seasonNumber}}

- - - - \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index 300599063..e9da2342f 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, Output } from "@angular/core"; -import { IChildRequests, IIssueCategory } from "../interfaces"; +import { IChildRequests } from "../interfaces"; import { NotificationService, RequestService } from "../services"; @@ -13,13 +13,6 @@ export class TvRequestChildrenComponent { @Output() public requestDeleted = new EventEmitter(); - @Input() public issueCategories: IIssueCategory[]; - @Input() public issuesEnabled: boolean; - @Input() public issueProviderId: string; - public issuesBarVisible = false; - public issueRequest: IChildRequests; - public issueCategorySelected: IIssueCategory; - constructor(private requestService: RequestService, private notificationService: NotificationService) { } @@ -101,13 +94,6 @@ export class TvRequestChildrenComponent { }); } - public reportIssue(catId: IIssueCategory, req: IChildRequests) { - this.issueRequest = req; - this.issueCategorySelected = catId; - this.issuesBarVisible = true; - this.issueProviderId = req.id.toString(); - } - private removeRequestFromUi(key: IChildRequests) { const index = this.childRequests.indexOf(key, 0); if (index > -1) { diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html index a602d27e1..9a3c4d186 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html @@ -64,51 +64,63 @@

{{node.data.title}} ({{node.data.releaseDate | date: '
- +
- -
- - - + +
+ + + +
+ + +
+ + + +
+
- - -
- - -
- -
+ (requestDeleted)="childRequestDeleted($event)">
+ + \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index ad8b4ca50..fd708c936 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -14,7 +14,7 @@ import { AuthService } from "../auth/auth.service"; import { NotificationService, RequestService, SonarrService } from "../services"; import { TreeNode } from "primeng/primeng"; -import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests } from "../interfaces"; +import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests, IChildRequests } from "../interfaces"; @Component({ selector: "tv-requests", @@ -33,6 +33,9 @@ export class TvRequestsComponent implements OnInit { @Input() public issueCategories: IIssueCategory[]; @Input() public issuesEnabled: boolean; public issueProviderId: string; + public issuesBarVisible = false; + public issueRequest: IChildRequests; + public issueCategorySelected: IIssueCategory; public sonarrProfiles: ISonarrProfile[] = []; public sonarrRootFolders: ISonarrRootFolder[] = []; @@ -205,6 +208,13 @@ export class TvRequestsComponent implements OnInit { } } + public reportIssue(catId: IIssueCategory, req: IChildRequests) { + this.issueRequest = req; + this.issueCategorySelected = catId; + this.issuesBarVisible = true; + this.issueProviderId = req.id.toString(); + } + private resetSearch() { this.currentlyLoaded = 5; this.loadInit(); From 4151b3d7866ccf4e0735cc74c83aae9d4401e7e0 Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 15:43:46 -0700 Subject: [PATCH 02/15] Items 3) and 4) on issue #2124 --- .../app/issues/issueDetails.component.html | 2 +- .../app/issues/issuestable.component.html | 8 +-- .../app/issues/issuestable.component.ts | 20 ++++++- .../app/requests/movierequests.component.html | 59 ++++++++++--------- .../app/requests/movierequests.component.ts | 47 ++++++++++++++- 5 files changed, 96 insertions(+), 40 deletions(-) diff --git a/src/Ombi/ClientApp/app/issues/issueDetails.component.html b/src/Ombi/ClientApp/app/issues/issueDetails.component.html index e88ad621c..990b9d636 100644 --- a/src/Ombi/ClientApp/app/issues/issueDetails.component.html +++ b/src/Ombi/ClientApp/app/issues/issueDetails.component.html @@ -1,5 +1,5 @@
-
+

{{issue.title}}

diff --git a/src/Ombi/ClientApp/app/issues/issuestable.component.html b/src/Ombi/ClientApp/app/issues/issuestable.component.html index f98d6eb0e..83dc8a1db 100644 --- a/src/Ombi/ClientApp/app/issues/issuestable.component.html +++ b/src/Ombi/ClientApp/app/issues/issuestable.component.html @@ -1,25 +1,25 @@ - - - -
+ + + + diff --git a/src/Ombi/ClientApp/app/issues/issuestable.component.ts b/src/Ombi/ClientApp/app/issues/issuestable.component.ts index ee93e689d..f03dd9a6d 100644 --- a/src/Ombi/ClientApp/app/issues/issuestable.component.ts +++ b/src/Ombi/ClientApp/app/issues/issuestable.component.ts @@ -20,11 +20,25 @@ export class IssuesTableComponent { public rowCount = 10; - public setOrder(value: string) { + public setOrder(value: string, el: any) { + el = el.toElement || el.relatedTarget || el.target || el.srcElement; + + if (el.nodeName === "A") { + el = el.parentElement; + } + + const parent = el.parentElement; + const previousFilter = parent.querySelector(".active"); + if (this.order === value) { - this.reverse = !this.reverse; + this.reverse = !this.reverse; + } else { + if (previousFilter) { + previousFilter.className = ""; + } + el.className = "active"; } - + this.order = value; } diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.html b/src/Ombi/ClientApp/app/requests/movierequests.component.html index 6b2300f38..4b55eb4dd 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.html +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.html @@ -222,42 +222,43 @@

{{request.title}} ({{request.releaseDate | date: 'yyyy

{{ 'Requests.Filter' | translate }}


- -

{{ 'Filter.FilterHeaderAvailability' | translate }}

-
-
- - +
+

{{ 'Filter.FilterHeaderAvailability' | translate }}

+
+
+ + +
-
-
-
- - +
+
+ + +
- -

{{ 'Filter.FilterHeaderRequestStatus' | translate }}

-
-
- - +
+

{{ 'Filter.FilterHeaderRequestStatus' | translate }}

+
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
- - \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index 0fc5f6651..37a1935a1 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -149,7 +149,16 @@ export class MovieRequestsComponent implements OnInit { event.preventDefault(); } - public clearFilter() { + public clearFilter(el: any) { + el = el.toElement || el.relatedTarget || el.target || el.srcElement; + + el = el.parentElement; + el = el.querySelectorAll("INPUT"); + for (var i = 0; i < el.length; i++) { + el[i].checked = false; + el[i].parentElement.classList.remove("active"); + } + this.filterDisplay = false; this.filter.availabilityFilter = FilterType.None; this.filter.statusFilter = FilterType.None; @@ -157,7 +166,23 @@ export class MovieRequestsComponent implements OnInit { this.resetSearch(); } - public filterAvailability(filter: FilterType) { + public filterAvailability(filter: FilterType, el: any) { + el = el.toElement || el.relatedTarget || el.target || el.srcElement; + + el = el.parentElement; //gets radio div + el = el.parentElement; //gets form group div + el = el.parentElement; //gets status filter div + el = el.querySelectorAll("INPUT"); + for (var i = 0; i < el.length; i++) { + if (el[i].checked) { + if (!el[i].parentElement.classList.contains("active")) { + el[i].parentElement.className += " active"; + } + } else { + el[i].parentElement.classList.remove("active"); + } + } + this.filter.availabilityFilter = filter; this.requestService.filterMovies(this.filter) .subscribe(x => { @@ -166,7 +191,23 @@ export class MovieRequestsComponent implements OnInit { }); } - public filterStatus(filter: FilterType) { + public filterStatus(filter: FilterType, el: any) { + el = el.toElement || el.relatedTarget || el.target || el.srcElement; + + el = el.parentElement; //gets radio div + el = el.parentElement; //gets form group div + el = el.parentElement; //gets status filter div + el = el.querySelectorAll("INPUT"); + for (var i = 0; i < el.length; i++) { + if (el[i].checked) { + if (!el[i].parentElement.classList.contains("active")) { + el[i].parentElement.className += " active"; + } + } else { + el[i].parentElement.classList.remove("active"); + } + } + this.filter.statusFilter = filter; this.requestService.filterMovies(this.filter) .subscribe(x => { From 398cfca035518255b893e39fbec7f63677504209 Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 19:32:51 -0700 Subject: [PATCH 03/15] Item 6) on issue #2124 --- .../app/issues/issueDetails.component.ts | 12 ++++++++++-- .../app/requests/movierequests.component.html | 2 +- .../app/requests/movierequests.component.ts | 5 +++++ .../app/requests/tvrequests.component.ts | 4 ++++ .../app/search/moviesearch.component.html | 2 +- .../app/search/moviesearch.component.ts | 11 ++++++++--- .../ClientApp/app/search/tvsearch.component.ts | 10 +++++++++- src/Ombi/wwwroot/images/default_movie_poster.png | Bin 0 -> 1685 bytes src/Ombi/wwwroot/images/default_tv_poster.png | Bin 0 -> 1776 bytes 9 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 src/Ombi/wwwroot/images/default_movie_poster.png create mode 100644 src/Ombi/wwwroot/images/default_tv_poster.png diff --git a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts index 34fcbe302..4b9015e38 100644 --- a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts +++ b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts @@ -98,7 +98,11 @@ export class IssueDetailsComponent implements OnInit { ("url(" + x + ")"); }); this.imageService.getMoviePoster(issue.providerId).subscribe(x => { - this.posterPath = x.toString(); + if (x.length === 0) { + this.posterPath = "../../../images/default_movie_poster.png" + } else { + this.posterPath = x.toString(); + } }); } else { @@ -107,7 +111,11 @@ export class IssueDetailsComponent implements OnInit { ("url(" + x + ")"); }); this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => { - this.posterPath = x.toString(); + if (x.length === 0) { + this.posterPath = "../../../images/default_tv_poster.png" + } else { + this.posterPath = x.toString(); + } }); } diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.html b/src/Ombi/ClientApp/app/requests/movierequests.component.html index 4b55eb4dd..8eded8dba 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.html +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.html @@ -67,7 +67,7 @@
- poster + poster
diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index 37a1935a1..fb838152e 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -285,6 +285,11 @@ export class MovieRequestsComponent implements OnInit { this.movieRequests.forEach((req) => { this.movieRequests.forEach((req) => this.setBackground(req)); + if (req.posterPath === null) { + req.posterPath = "../../../images/default_movie_poster.png" + } else { + req.posterPath = "https://image.tmdb.org/t/p/w300/" + req.posterPath; + } }); this.radarrService.getQualityProfilesFromSettings().subscribe(c => { this.radarrProfiles = c; diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index fd708c936..64f0b4b60 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -194,6 +194,9 @@ export class TvRequestsComponent implements OnInit { .subscribe(x => { this.tvRequests = x; this.tvRequests.forEach((val, index) => { + if (val.data.posterPath === null) { + val.data.posterPath = "../../../images/default_tv_poster.png" + } this.loadBackdrop(val); this.setOverride(val.data); }); @@ -219,6 +222,7 @@ export class TvRequestsComponent implements OnInit { this.currentlyLoaded = 5; this.loadInit(); } + private loadBackdrop(val: TreeNode): void { this.imageService.getTvBanner(val.data.tvDbId).subscribe(x => { val.data.background = this.sanitizer.bypassSecurityTrustStyle diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.html b/src/Ombi/ClientApp/app/search/moviesearch.component.html index 58d8415fb..cac78531b 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.html +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.html @@ -33,7 +33,7 @@
- poster + poster
diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 819463c4f..0d2a3f101 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -157,8 +157,12 @@ export class MovieSearchComponent implements OnInit { private getExtraInfo() { - this.movieResults.forEach((val, index) => { - + this.movieResults.forEach((val, index) => { + if (val.posterPath === null) { + val.posterPath = "../../../images/default_movie_poster.png"; + } else { + val.posterPath = "https://image.tmdb.org/t/p/w300/" + val.posterPath; + } val.background = this.sanitizer. bypassSecurityTrustStyle ("url(" + "https://image.tmdb.org/t/p/w1280" + val.backdropPath + ")"); @@ -174,7 +178,8 @@ export class MovieSearchComponent implements OnInit { if (index > -1) { const copy = { ...this.movieResults[index] }; this.movieResults[index] = updated; - this.movieResults[index].background = copy.background; + this.movieResults[index].background = copy.background; + this.movieResults[index].posterPath = copy.posterPath; } } private clearResults() { diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index 961e85f63..d17ef7775 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -129,8 +129,8 @@ export class TvSearchComponent implements OnInit { public getExtraInfo() { this.tvResults.forEach((val, index) => { + console.log(val); this.imageService.getTvBanner(val.data.id).subscribe(x => { - val.data.background = this.sanitizer. bypassSecurityTrustStyle ("url(" + x + ")"); @@ -138,6 +138,7 @@ export class TvSearchComponent implements OnInit { this.searchService.getShowInformationTreeNode(val.data.id) .subscribe(x => { if (x.data) { + this.setDefaults(x); this.updateItem(val, x); } else { const index = this.tvResults.indexOf(val, 0); @@ -216,6 +217,7 @@ export class TvSearchComponent implements OnInit { 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; @@ -225,6 +227,12 @@ export class TvSearchComponent implements OnInit { } } + private setDefaults(x: any) { + if (x.data.banner === null) { + x.data.banner = "../../../images/default_tv_poster.png"; + } + } + private clearResults() { this.tvResults = []; this.searchApplied = false; diff --git a/src/Ombi/wwwroot/images/default_movie_poster.png b/src/Ombi/wwwroot/images/default_movie_poster.png new file mode 100644 index 0000000000000000000000000000000000000000..f5cec85a5b313321a2840ebbb07c5bd52843678b GIT binary patch literal 1685 zcmeAS@N?(olHy`uVBq!ia0vp^Cm0wQbvW37thQf&_AxN9#dx|nhE&XXd)MDzDq80F zL*t5{{xK7>axU-q_ILjhy;;k0V#ong(>C9n;y>TcRBr!{9U9FC7hEZgUAKPy>9oz2N3ZUcz5BDX>_Uy5{^px& zg8BbUzw-L)sT?!y&p-d%@P4`G|8xI;tv+g#2^mm8;lT*mq2z`OVFPiJklx^Z2ehb`4aO7_j`|1VjJ98Nzq ziu+lm`TqWX{lgDGJh=bdUuA;roqPA}ZZ?O6hN?~Wl#tSm3gzYH zOV_>LbT_a5_xFn#AwX}hUh{UXu!r~Sue)mg|Eqnz@%HW8MU|B|SN8rY+pQbFzphru zUDN)WwG5y4{`>ZaPTdomt{+uZQITP@?QUMVok0J~ou*5FAGU`l*UXnso-Fwo5gI!8 z)`IDu{>-}c_o4i{q^(!pe?MJgcmL<2`zb~*QxwwE(}C_#KhDnl7p?U$vM_s-&JKO7W#)iK^>&8k&}e6QcVTUU7J?g~$9 zrcBM=Svq3fa~G@qt=nJo=f}qd#*u&P>Ys~hE>_cbR?yulX?n9%_4Sh{Pc){7-0qph z@ucz_G)*P&U%Iqk*0i#s!s3+L-{-SteN%Mvy(Q@34K!&__4mB><))GAuRs0#{5<>q zGru1mZdaFnw`$d?pFb-fr^ZQtDP!5xelus=_1EmDpMHAqe`40|yVIT)?flGWFV|nb z&(66TV$br3>K!|GX3CVme{>}$_ImH*clo(SKOrvcm4Wx>weSTSu&S_fqj2p zZT21J-s8#AU&ZDmZG95!`_Bhn2y6j!K>=x!_3883)w?B5fE+SAe0S5;K8J4`-mf^B zZObuxUw`1_|9%SWCNg}dj~+dG(B9#Adb3QQ10OJ@{bX5T?xO&AO**5VSog8Q^2KUz zIaF@snC-V?EZZ7o+BfS;>D`^Zzs?6vj(xT3-`mM~=CjXc>%H|YoM~QR^WyuR<`vzG z)lNSCy*YcqM0uNL7W?^zyDV1z7BZXdyYls}k25C*ty;Z$b>81s&3uJjtfPe(JPIi& c&j0Yl zO)W`OsL0L9E4HezRRWu91!RMS^_3LBN=mYAl^~9a@C{IK&M!(;Fx4~DO*S+!QZTpF zGc+@>G&0dqFfuSS*EcZNH#F8YFtjo-vof|+fC43;ZAB?*RzWUqP`iLUTcwPWk^(Dz z{qpj1y>er{{GxPyLrY6beFGzXBO_g)3fZE`@j@w*YQzUNJP7fB~jokyxN_sAmB35=^15FMg%Dxp39RB|)hO_hL1; zIHa;5RX-@TIKQ+g85nVC${?!>telHd6HD@oLh|!-V4)b0kzbNuoRMFk;OwlR5uTZs zl3!k|30CgwYvq|&T#}fVoa*Ufs{}MaFEca6%FM*V$kfEu*x1s*($LV=!qLdW)zQSn z+1SzCz{Sbc5~kNBKe;qFHLnDwHwB^B1gBn5O2{n$+U$~Alv$RV;#QQOs{r<~RVHq? z7~(V!sy799yBiO3djj(>Wj6+5Kc& z-Lg|`mm~G2%U{@X#JgdGfY>3XL`9tz)q1Rudu9rqma}8`ceyFN<)w9o)+i&OooDey! z*KM&u`n=~Kw~9Utl2{k2yZ+T`gDi;~a<5riL@yjTRCVChyk%@+*POTMvu&%aZ@ZdR zx-;h1r$E0+N0T1j=QZ4MrzSzug{Y8fVdeiIW*^}@>4?Fhtb5jfmfQ{M*bsO5Wr@*- z4YR_hEp2SQx@VEbs#R4}GY_vweDLF5Yy9MsD%ZNhW-ZJ8#}#({YuWC*IcD!>{V_Te z{q^^|9&*r<0+{(ORQ@Dylq8^mODt z#fC-{YMuVH{NCLS_4nVF9qJ0c;qtt)&PHy2&B9fywB~%TvHKk+u@)G_aqHKfUWb`> jI8G1w)b;;eKLay^g>(Pw(m4fvpgPFY)z4*}Q$iB}QrLNN literal 0 HcmV?d00001 From 3275665f17c151be8eb21e976ff6b07ee81e4948 Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 19:58:02 -0700 Subject: [PATCH 04/15] Fixed build error caused by changing type of issueRequest --- src/Ombi/ClientApp/app/requests/tvrequests.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 64f0b4b60..6701fb9e4 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -14,7 +14,7 @@ import { AuthService } from "../auth/auth.service"; import { NotificationService, RequestService, SonarrService } from "../services"; import { TreeNode } from "primeng/primeng"; -import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests, IChildRequests } from "../interfaces"; +import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests } from "../interfaces"; @Component({ selector: "tv-requests", @@ -34,7 +34,7 @@ export class TvRequestsComponent implements OnInit { @Input() public issuesEnabled: boolean; public issueProviderId: string; public issuesBarVisible = false; - public issueRequest: IChildRequests; + public issueRequest: ITvRequests; public issueCategorySelected: IIssueCategory; public sonarrProfiles: ISonarrProfile[] = []; @@ -211,7 +211,7 @@ export class TvRequestsComponent implements OnInit { } } - public reportIssue(catId: IIssueCategory, req: IChildRequests) { + public reportIssue(catId: IIssueCategory, req: ITvRequests) { this.issueRequest = req; this.issueCategorySelected = catId; this.issuesBarVisible = true; From 321618cd376754908031207fad54166bbd6c7c2b Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 21:17:33 -0700 Subject: [PATCH 05/15] Reverting 1) to see if build errors are resolved --- .../requests/tvrequest-children.component.html | 13 ++++++++++++- .../requests/tvrequest-children.component.ts | 16 +++++++++++++++- .../app/requests/tvrequests.component.html | 18 ++++-------------- .../app/requests/tvrequests.component.ts | 11 ----------- src/Ombi/ClientApp/styles/Themes/plex.scss | 2 +- src/Ombi/ClientApp/styles/base.scss | 4 ++++ 6 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html index 736878d4b..110bbccd9 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html @@ -22,7 +22,15 @@
- +
@@ -93,3 +101,6 @@

{{ 'Requests.Season' | translate }} {{season.seasonNumber}}

+ + \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index e9da2342f..300599063 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, Output } from "@angular/core"; -import { IChildRequests } from "../interfaces"; +import { IChildRequests, IIssueCategory } from "../interfaces"; import { NotificationService, RequestService } from "../services"; @@ -13,6 +13,13 @@ export class TvRequestChildrenComponent { @Output() public requestDeleted = new EventEmitter(); + @Input() public issueCategories: IIssueCategory[]; + @Input() public issuesEnabled: boolean; + @Input() public issueProviderId: string; + public issuesBarVisible = false; + public issueRequest: IChildRequests; + public issueCategorySelected: IIssueCategory; + constructor(private requestService: RequestService, private notificationService: NotificationService) { } @@ -94,6 +101,13 @@ export class TvRequestChildrenComponent { }); } + public reportIssue(catId: IIssueCategory, req: IChildRequests) { + this.issueRequest = req; + this.issueCategorySelected = catId; + this.issuesBarVisible = true; + this.issueProviderId = req.id.toString(); + } + private removeRequestFromUi(key: IChildRequests) { const index = this.childRequests.indexOf(key, 0); if (index > -1) { diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html index 9a3c4d186..c39004217 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html @@ -99,28 +99,18 @@

{{node.data.title}} ({{node.data.releaseDate | date: '

-
- +
- - \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 6701fb9e4..7061760ca 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -32,10 +32,6 @@ export class TvRequestsComponent implements OnInit { @Input() public issueCategories: IIssueCategory[]; @Input() public issuesEnabled: boolean; - public issueProviderId: string; - public issuesBarVisible = false; - public issueRequest: ITvRequests; - public issueCategorySelected: IIssueCategory; public sonarrProfiles: ISonarrProfile[] = []; public sonarrRootFolders: ISonarrRootFolder[] = []; @@ -211,13 +207,6 @@ export class TvRequestsComponent implements OnInit { } } - public reportIssue(catId: IIssueCategory, req: ITvRequests) { - this.issueRequest = req; - this.issueCategorySelected = catId; - this.issuesBarVisible = true; - this.issueProviderId = req.id.toString(); - } - private resetSearch() { this.currentlyLoaded = 5; this.loadInit(); diff --git a/src/Ombi/ClientApp/styles/Themes/plex.scss b/src/Ombi/ClientApp/styles/Themes/plex.scss index 1e3c27eaf..1475aef91 100644 --- a/src/Ombi/ClientApp/styles/Themes/plex.scss +++ b/src/Ombi/ClientApp/styles/Themes/plex.scss @@ -351,5 +351,5 @@ button.list-group-item:focus { position: absolute; } table.table > thead > tr > th.active { - background-color: transparent; + background-color: $primary-colour; } \ No newline at end of file diff --git a/src/Ombi/ClientApp/styles/base.scss b/src/Ombi/ClientApp/styles/base.scss index 619dd8042..3a5deb2a3 100644 --- a/src/Ombi/ClientApp/styles/base.scss +++ b/src/Ombi/ClientApp/styles/base.scss @@ -541,6 +541,10 @@ $border-radius: 10px; cursor: pointer; } +.table-usermanagement { + margin-top: 20px; +} + .input-group-sm { padding-top: 2px; padding-bottom: 2px; From d54ded57d9438b41667421c2f3be2dd2fb6abc3d Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 21:41:36 -0700 Subject: [PATCH 06/15] redoing 1) since it did not fix build errors, changed tsconfig to allow implicitAny in attempt to fix build errors --- .../requests/tvrequest-children.component.html | 13 +------------ .../requests/tvrequest-children.component.ts | 16 +--------------- .../app/requests/tvrequests.component.html | 18 ++++++++++++++---- .../app/requests/tvrequests.component.ts | 11 +++++++++++ src/Ombi/tsconfig.json | 2 +- 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html index 110bbccd9..736878d4b 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.html @@ -22,15 +22,7 @@ - + @@ -101,6 +93,3 @@

{{ 'Requests.Season' | translate }} {{season.seasonNumber}}

- - \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index 300599063..e9da2342f 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, Output } from "@angular/core"; -import { IChildRequests, IIssueCategory } from "../interfaces"; +import { IChildRequests } from "../interfaces"; import { NotificationService, RequestService } from "../services"; @@ -13,13 +13,6 @@ export class TvRequestChildrenComponent { @Output() public requestDeleted = new EventEmitter(); - @Input() public issueCategories: IIssueCategory[]; - @Input() public issuesEnabled: boolean; - @Input() public issueProviderId: string; - public issuesBarVisible = false; - public issueRequest: IChildRequests; - public issueCategorySelected: IIssueCategory; - constructor(private requestService: RequestService, private notificationService: NotificationService) { } @@ -101,13 +94,6 @@ export class TvRequestChildrenComponent { }); } - public reportIssue(catId: IIssueCategory, req: IChildRequests) { - this.issueRequest = req; - this.issueCategorySelected = catId; - this.issuesBarVisible = true; - this.issueProviderId = req.id.toString(); - } - private removeRequestFromUi(key: IChildRequests) { const index = this.childRequests.indexOf(key, 0); if (index > -1) { diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html index c39004217..9a3c4d186 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html @@ -99,18 +99,28 @@

{{node.data.title}} ({{node.data.releaseDate | date: ' +
- +
+ + \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 7061760ca..6701fb9e4 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -32,6 +32,10 @@ export class TvRequestsComponent implements OnInit { @Input() public issueCategories: IIssueCategory[]; @Input() public issuesEnabled: boolean; + public issueProviderId: string; + public issuesBarVisible = false; + public issueRequest: ITvRequests; + public issueCategorySelected: IIssueCategory; public sonarrProfiles: ISonarrProfile[] = []; public sonarrRootFolders: ISonarrRootFolder[] = []; @@ -207,6 +211,13 @@ export class TvRequestsComponent implements OnInit { } } + public reportIssue(catId: IIssueCategory, req: ITvRequests) { + this.issueRequest = req; + this.issueCategorySelected = catId; + this.issuesBarVisible = true; + this.issueProviderId = req.id.toString(); + } + private resetSearch() { this.currentlyLoaded = 5; this.loadInit(); diff --git a/src/Ombi/tsconfig.json b/src/Ombi/tsconfig.json index daff6b451..8f860760c 100644 --- a/src/Ombi/tsconfig.json +++ b/src/Ombi/tsconfig.json @@ -11,7 +11,7 @@ "noUnusedLocals": true, "noImplicitThis": true, "noImplicitReturns": true, - "noImplicitAny": true, + "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, "alwaysStrict": true, "emitDecoratorMetadata": true, From 8aee398e9ef9562fc2f0f3e8c377637a056ec2cf Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 22:12:50 -0700 Subject: [PATCH 07/15] Fixing silly mistakes and tidying up --- .../app/issues/issueDetails.component.ts | 4 +- .../app/requests/movierequests.component.ts | 39 +++++++++++-------- .../app/requests/tvrequests.component.ts | 16 ++++---- .../app/search/moviesearch.component.ts | 7 ++-- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts index 4b9015e38..1072bedbd 100644 --- a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts +++ b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts @@ -99,7 +99,7 @@ export class IssueDetailsComponent implements OnInit { }); this.imageService.getMoviePoster(issue.providerId).subscribe(x => { if (x.length === 0) { - this.posterPath = "../../../images/default_movie_poster.png" + this.posterPath = "../../../images/default_movie_poster.png"; } else { this.posterPath = x.toString(); } @@ -112,7 +112,7 @@ export class IssueDetailsComponent implements OnInit { }); this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => { if (x.length === 0) { - this.posterPath = "../../../images/default_tv_poster.png" + this.posterPath = "../../../images/default_tv_poster.png"; } else { this.posterPath = x.toString(); } diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index fb838152e..a53fa920a 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -154,7 +154,7 @@ export class MovieRequestsComponent implements OnInit { el = el.parentElement; el = el.querySelectorAll("INPUT"); - for (var i = 0; i < el.length; i++) { + for (let i = 0; i < el.length; i++) { el[i].checked = false; el[i].parentElement.classList.remove("active"); } @@ -173,13 +173,13 @@ export class MovieRequestsComponent implements OnInit { el = el.parentElement; //gets form group div el = el.parentElement; //gets status filter div el = el.querySelectorAll("INPUT"); - for (var i = 0; i < el.length; i++) { - if (el[i].checked) { - if (!el[i].parentElement.classList.contains("active")) { - el[i].parentElement.className += " active"; + for (el of el) { + if (el.checked) { + if (!el.parentElement.classList.contains("active")) { + el.parentElement.className += " active"; } } else { - el[i].parentElement.classList.remove("active"); + el.parentElement.classList.remove("active"); } } @@ -198,13 +198,13 @@ export class MovieRequestsComponent implements OnInit { el = el.parentElement; //gets form group div el = el.parentElement; //gets status filter div el = el.querySelectorAll("INPUT"); - for (var i = 0; i < el.length; i++) { - if (el[i].checked) { - if (!el[i].parentElement.classList.contains("active")) { - el[i].parentElement.className += " active"; + for (el of el) { + if (el.checked) { + if (!el.parentElement.classList.contains("active")) { + el.parentElement.className += " active"; } } else { - el[i].parentElement.classList.remove("active"); + el.parentElement.classList.remove("active"); } } @@ -284,12 +284,8 @@ export class MovieRequestsComponent implements OnInit { this.movieRequests = x; this.movieRequests.forEach((req) => { - this.movieRequests.forEach((req) => this.setBackground(req)); - if (req.posterPath === null) { - req.posterPath = "../../../images/default_movie_poster.png" - } else { - req.posterPath = "https://image.tmdb.org/t/p/w300/" + req.posterPath; - } + this.setBackground(req); + this.setPoster(req); }); this.radarrService.getQualityProfilesFromSettings().subscribe(c => { this.radarrProfiles = c; @@ -342,11 +338,20 @@ export class MovieRequestsComponent implements OnInit { } private setOverride(req: IMovieRequests): void { + this.setPoster(req); this.setBackground(req); this.setQualityOverrides(req); this.setRootFolderOverrides(req); } + private setPoster(req: IMovieRequests): void { + if (req.posterPath === null) { + req.posterPath = "../../../images/default_movie_poster.png"; + } else { + req.posterPath = "https://image.tmdb.org/t/p/w300/" + req.posterPath; + } + } + private setBackground(req: IMovieRequests): void { req.backgroundPath = this.sanitizer.bypassSecurityTrustStyle ("url(" + "https://image.tmdb.org/t/p/w1280" + req.background + ")"); diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 6701fb9e4..96acf75bd 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -154,6 +154,13 @@ export class TvRequestsComponent implements OnInit { this.updateRequest(searchResult); } + public reportIssue(catId: IIssueCategory, req: ITvRequests) { + this.issueRequest = req; + this.issueCategorySelected = catId; + this.issuesBarVisible = true; + this.issueProviderId = req.id.toString(); + } + private setOverride(req: ITvRequests): void { this.setQualityOverrides(req); this.setRootFolderOverrides(req); @@ -195,7 +202,7 @@ export class TvRequestsComponent implements OnInit { this.tvRequests = x; this.tvRequests.forEach((val, index) => { if (val.data.posterPath === null) { - val.data.posterPath = "../../../images/default_tv_poster.png" + val.data.posterPath = "../../../images/default_tv_poster.png"; } this.loadBackdrop(val); this.setOverride(val.data); @@ -211,13 +218,6 @@ export class TvRequestsComponent implements OnInit { } } - public reportIssue(catId: IIssueCategory, req: ITvRequests) { - this.issueRequest = req; - this.issueCategorySelected = catId; - this.issuesBarVisible = true; - this.issueProviderId = req.id.toString(); - } - private resetSearch() { this.currentlyLoaded = 5; this.loadInit(); diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 0d2a3f101..0abc10474 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -163,10 +163,9 @@ export class MovieSearchComponent implements OnInit { } else { val.posterPath = "https://image.tmdb.org/t/p/w300/" + val.posterPath; } - val.background = this.sanitizer. - bypassSecurityTrustStyle - ("url(" + "https://image.tmdb.org/t/p/w1280" + val.backdropPath + ")"); - this.searchService.getMovieInformation(val.id) + val.background = this.sanitizer.bypassSecurityTrustStyle + ("url(" + "https://image.tmdb.org/t/p/w1280" + val.backdropPath + ")"); + this.searchService.getMovieInformation(val.id) .subscribe(m => { this.updateItem(val, m); }); From c4bbfdcee60aef6c161de05568982aac6a960807 Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 22:18:47 -0700 Subject: [PATCH 08/15] Fixing the final lint issue --- src/Ombi/ClientApp/app/requests/movierequests.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index a53fa920a..374761c41 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -154,9 +154,9 @@ export class MovieRequestsComponent implements OnInit { el = el.parentElement; el = el.querySelectorAll("INPUT"); - for (let i = 0; i < el.length; i++) { - el[i].checked = false; - el[i].parentElement.classList.remove("active"); + for (el of el) { + el.checked = false; + el.parentElement.classList.remove("active"); } this.filterDisplay = false; From e742f246d945389f317c22b3160815f40e03387b Mon Sep 17 00:00:00 2001 From: Anojh Date: Thu, 5 Apr 2018 22:45:33 -0700 Subject: [PATCH 09/15] Item 7) on issue #2124 by changing how titles are displayed for tv search results --- src/Ombi/ClientApp/app/search/tvsearch.component.html | 2 +- src/Ombi/ClientApp/app/search/tvsearch.component.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.html b/src/Ombi/ClientApp/app/search/tvsearch.component.html index fb1729e50..42232a564 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.html +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.html @@ -62,7 +62,7 @@
- +

{{node.data.title}} ({{node.data.firstAired | date: 'yyyy'}})

diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index d17ef7775..bb30810e4 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -129,7 +129,6 @@ export class TvSearchComponent implements OnInit { public getExtraInfo() { this.tvResults.forEach((val, index) => { - console.log(val); this.imageService.getTvBanner(val.data.id).subscribe(x => { val.data.background = this.sanitizer. bypassSecurityTrustStyle @@ -230,7 +229,13 @@ export class TvSearchComponent implements OnInit { private setDefaults(x: any) { if (x.data.banner === null) { x.data.banner = "../../../images/default_tv_poster.png"; - } + } + + if (x.data.imdbId === null) { + x.data.imdbId = "https://www.tvmaze.com/shows/" + x.data.seriesId; + } else { + x.data.imdbId = "http://www.imdb.com/title/" + x.data.imdbId + "/"; + } } private clearResults() { From 899709f35ee7c5d55524a93924f7bdc4902e6fb8 Mon Sep 17 00:00:00 2001 From: Anojh Date: Fri, 6 Apr 2018 02:57:09 -0700 Subject: [PATCH 10/15] Changing how request titles are displayed to keep consistent with item 7) changes --- .../ClientApp/app/requests/requests.module.ts | 3 ++- .../app/requests/tvrequests.component.html | 2 +- .../app/requests/tvrequests.component.ts | 23 +++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/requests.module.ts b/src/Ombi/ClientApp/app/requests/requests.module.ts index 7bddee71c..8ef4732d5 100644 --- a/src/Ombi/ClientApp/app/requests/requests.module.ts +++ b/src/Ombi/ClientApp/app/requests/requests.module.ts @@ -15,7 +15,7 @@ import { TvRequestsComponent } from "./tvrequests.component"; import { SidebarModule, TreeTableModule } from "primeng/primeng"; -import { IdentityService, RadarrService, RequestService, SonarrService } from "../services"; +import { IdentityService, RadarrService, RequestService, SonarrService, SearchService } from "../services"; import { AuthGuard } from "../auth/auth.guard"; @@ -51,6 +51,7 @@ const routes: Routes = [ RequestService, RadarrService, SonarrService, + SearchService, ], }) diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html index 9a3c4d186..714d8ff3b 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html @@ -39,7 +39,7 @@
diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 96acf75bd..93a8abcee 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -11,7 +11,7 @@ import "rxjs/add/operator/distinctUntilChanged"; import "rxjs/add/operator/map"; import { AuthService } from "../auth/auth.service"; -import { NotificationService, RequestService, SonarrService } from "../services"; +import { NotificationService, RequestService, SonarrService, SearchService } from "../services"; import { TreeNode } from "primeng/primeng"; import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests } from "../interfaces"; @@ -46,6 +46,7 @@ export class TvRequestsComponent implements OnInit { constructor(private requestService: RequestService, private auth: AuthService, private sanitizer: DomSanitizer, + private searchService: SearchService, private imageService: ImageService, private sonarrService: SonarrService, private notificationService: NotificationService) { @@ -201,9 +202,7 @@ export class TvRequestsComponent implements OnInit { .subscribe(x => { this.tvRequests = x; this.tvRequests.forEach((val, index) => { - if (val.data.posterPath === null) { - val.data.posterPath = "../../../images/default_tv_poster.png"; - } + this.setDefaults(val); this.loadBackdrop(val); this.setOverride(val.data); }); @@ -223,6 +222,22 @@ export class TvRequestsComponent implements OnInit { this.loadInit(); } + private setDefaults(val: any) { + if (val.data.posterPath === null) { + val.data.posterPath = "../../../images/default_tv_poster.png"; + } + + if (val.data.imdbId.length === 0) { + this.searchService.getShowInformationTreeNode(val.data.tvDbId).subscribe(x => { + if (x.data) { + val.data.imdbId = "https://www.tvmaze.com/shows/" + x.data.seriesId; + } + }); + } else { + val.data.imdbId = "http://www.imdb.com/title/" + val.data.imdbId + "/"; + } + } + private loadBackdrop(val: TreeNode): void { this.imageService.getTvBanner(val.data.tvDbId).subscribe(x => { val.data.background = this.sanitizer.bypassSecurityTrustStyle From 39afbbf377c874b2c0abc5ec25ef5146ad457f5f Mon Sep 17 00:00:00 2001 From: Anojh Date: Fri, 6 Apr 2018 03:04:48 -0700 Subject: [PATCH 11/15] Fixing lint issues causing build failures --- src/Ombi/ClientApp/app/requests/requests.module.ts | 4 ++-- src/Ombi/ClientApp/app/requests/tvrequests.component.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/requests.module.ts b/src/Ombi/ClientApp/app/requests/requests.module.ts index 8ef4732d5..ca77a853d 100644 --- a/src/Ombi/ClientApp/app/requests/requests.module.ts +++ b/src/Ombi/ClientApp/app/requests/requests.module.ts @@ -15,7 +15,7 @@ import { TvRequestsComponent } from "./tvrequests.component"; import { SidebarModule, TreeTableModule } from "primeng/primeng"; -import { IdentityService, RadarrService, RequestService, SonarrService, SearchService } from "../services"; +import { IdentityService, RadarrService, RequestService, SearchService, SonarrService } from "../services"; import { AuthGuard } from "../auth/auth.guard"; @@ -50,8 +50,8 @@ const routes: Routes = [ IdentityService, RequestService, RadarrService, - SonarrService, SearchService, + SonarrService, ], }) diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 93a8abcee..68e54d9a4 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -11,7 +11,7 @@ import "rxjs/add/operator/distinctUntilChanged"; import "rxjs/add/operator/map"; import { AuthService } from "../auth/auth.service"; -import { NotificationService, RequestService, SonarrService, SearchService } from "../services"; +import { NotificationService, RequestService, SearchService, SonarrService } from "../services"; import { TreeNode } from "primeng/primeng"; import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests } from "../interfaces"; From 0cdc45982603b35cedd731120c8b5ecc062329ca Mon Sep 17 00:00:00 2001 From: Anojh Date: Tue, 10 Apr 2018 17:30:54 -0700 Subject: [PATCH 12/15] Wrote backend API to get imdbid on request for tv shows that are missing it --- src/Ombi.Core/Engine/TvRequestEngine.cs | 7 +++++-- src/Ombi.Core/Helpers/TvShowRequestBuilder.cs | 16 +++++++++++++++- src/Ombi.Mapping/Profiles/MovieProfile.cs | 13 +++++++++++++ src/Ombi.TheMovieDbApi/IMovieDbApi.cs | 1 + src/Ombi.TheMovieDbApi/Models/SearchResult.cs | 3 +++ .../Models/TvSearchResult.cs | 18 ++++++++++++++++++ src/Ombi.TheMovieDbApi/TheMovieDbApi.cs | 13 ++++++++++++- .../ClientApp/app/requests/requests.module.ts | 3 +-- .../app/requests/tvrequests.component.ts | 13 ++----------- 9 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 src/Ombi.TheMovieDbApi/Models/TvSearchResult.cs diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs index aaa2d353d..7671c13fc 100644 --- a/src/Ombi.Core/Engine/TvRequestEngine.cs +++ b/src/Ombi.Core/Engine/TvRequestEngine.cs @@ -1,6 +1,7 @@ using System; using AutoMapper; using Ombi.Api.TvMaze; +using Ombi.Api.TheMovieDb; using Ombi.Core.Models.Requests; using Ombi.Core.Models.Search; using Ombi.Helpers; @@ -26,11 +27,12 @@ namespace Ombi.Core.Engine { public class TvRequestEngine : BaseMediaEngine, ITvRequestEngine { - public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, + public TvRequestEngine(ITvMazeApi tvApi, IMovieDbApi movApi, IRequestServiceMain requestService, IPrincipal user, INotificationHelper helper, IRuleEvaluator rule, OmbiUserManager manager, ITvSender sender, IAuditRepository audit, IRepository rl, ISettingsService settings, ICacheService cache) : base(user, requestService, rule, manager, cache, settings) { TvApi = tvApi; + MovieDbApi = movApi; NotificationHelper = helper; TvSender = sender; Audit = audit; @@ -39,6 +41,7 @@ public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPr private INotificationHelper NotificationHelper { get; } private ITvMazeApi TvApi { get; } + private IMovieDbApi MovieDbApi { get; } private ITvSender TvSender { get; } private IAuditRepository Audit { get; } private readonly IRepository _requestLog; @@ -47,7 +50,7 @@ public async Task RequestTvShow(TvRequestViewModel tv) { var user = await GetUser(); - var tvBuilder = new TvShowRequestBuilder(TvApi); + var tvBuilder = new TvShowRequestBuilder(TvApi, MovieDbApi); (await tvBuilder .GetShowInfo(tv.TvDbId)) .CreateTvList(tv) diff --git a/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs b/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs index 1f92536b8..e206af5c8 100644 --- a/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs +++ b/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs @@ -3,7 +3,9 @@ using System.Linq; using System.Threading.Tasks; using Ombi.Api.TvMaze; +using Ombi.Api.TheMovieDb; using Ombi.Api.TvMaze.Models; +using Ombi.Api.TheMovieDb.Models; using Ombi.Core.Models.Requests; using Ombi.Core.Models.Search; using Ombi.Helpers; @@ -16,12 +18,14 @@ namespace Ombi.Core.Helpers public class TvShowRequestBuilder { - public TvShowRequestBuilder(ITvMazeApi tvApi) + public TvShowRequestBuilder(ITvMazeApi tvApi, IMovieDbApi movApi) { TvApi = tvApi; + MovieDbApi = movApi; } private ITvMazeApi TvApi { get; } + private IMovieDbApi MovieDbApi { get; } public ChildRequests ChildRequest { get; set; } public List TvRequests { get; protected set; } @@ -29,10 +33,20 @@ public TvShowRequestBuilder(ITvMazeApi tvApi) public DateTime FirstAir { get; protected set; } public TvRequests NewRequest { get; protected set; } protected TvMazeShow ShowInfo { get; set; } + protected List Result { get; set; } public async Task GetShowInfo(int id) { ShowInfo = await TvApi.ShowLookupByTheTvDbId(id); + Result = await MovieDbApi.SearchTv(ShowInfo.name); + foreach (TvSearchResult result in Result) { + if (result.Name == ShowInfo.name) + { + var showIds = await MovieDbApi.GetTvExternals(result.Id); + ShowInfo.externals.imdb = showIds.imdb_id; + break; + } + } DateTime.TryParse(ShowInfo.premiered, out var dt); diff --git a/src/Ombi.Mapping/Profiles/MovieProfile.cs b/src/Ombi.Mapping/Profiles/MovieProfile.cs index d7e43fc50..dd7e03379 100644 --- a/src/Ombi.Mapping/Profiles/MovieProfile.cs +++ b/src/Ombi.Mapping/Profiles/MovieProfile.cs @@ -24,6 +24,19 @@ public MovieProfile() .ForMember(dest => dest.VoteAverage, opts => opts.MapFrom(src => src.vote_average)) .ForMember(dest => dest.VoteCount, opts => opts.MapFrom(src => src.vote_count)); + CreateMap() + .ForMember(dest => dest.BackdropPath, opts => opts.MapFrom(src => src.backdrop_path)) + .ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.id)) + .ForMember(dest => dest.OriginalLanguage, opts => opts.MapFrom(src => src.original_language)) + .ForMember(dest => dest.OriginalName, opts => opts.MapFrom(src => src.original_name)) + .ForMember(dest => dest.Overview, opts => opts.MapFrom(src => src.overview)) + .ForMember(dest => dest.Popularity, opts => opts.MapFrom(src => src.popularity)) + .ForMember(dest => dest.PosterPath, opts => opts.MapFrom(src => src.poster_path)) + .ForMember(dest => dest.ReleaseDate, opts => opts.MapFrom(src => src.first_air_date)) + .ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.name)) + .ForMember(dest => dest.VoteAverage, opts => opts.MapFrom(src => src.vote_average)) + .ForMember(dest => dest.VoteCount, opts => opts.MapFrom(src => src.vote_count)); + CreateMap() .ForMember(dest => dest.Adult, opts => opts.MapFrom(src => src.adult)) .ForMember(dest => dest.BackdropPath, opts => opts.MapFrom(src => src.backdrop_path)) diff --git a/src/Ombi.TheMovieDbApi/IMovieDbApi.cs b/src/Ombi.TheMovieDbApi/IMovieDbApi.cs index 787902a4b..5d0a89992 100644 --- a/src/Ombi.TheMovieDbApi/IMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/IMovieDbApi.cs @@ -12,6 +12,7 @@ public interface IMovieDbApi Task> NowPlaying(); Task> PopularMovies(); Task> SearchMovie(string searchTerm); + Task> SearchTv(string searchTerm); Task> TopRated(); Task> Upcoming(); Task> SimilarMovies(int movieId); diff --git a/src/Ombi.TheMovieDbApi/Models/SearchResult.cs b/src/Ombi.TheMovieDbApi/Models/SearchResult.cs index 81d8115f6..7b09b5e4b 100644 --- a/src/Ombi.TheMovieDbApi/Models/SearchResult.cs +++ b/src/Ombi.TheMovieDbApi/Models/SearchResult.cs @@ -32,9 +32,12 @@ public class SearchResult public bool adult { get; set; } public string overview { get; set; } public string release_date { get; set; } + public string first_air_date { get; set; } public int?[] genre_ids { get; set; } public int id { get; set; } public string original_title { get; set; } + public string original_name { get; set; } + public string name { get; set; } public string original_language { get; set; } public string title { get; set; } public string backdrop_path { get; set; } diff --git a/src/Ombi.TheMovieDbApi/Models/TvSearchResult.cs b/src/Ombi.TheMovieDbApi/Models/TvSearchResult.cs new file mode 100644 index 000000000..eaf93d7cc --- /dev/null +++ b/src/Ombi.TheMovieDbApi/Models/TvSearchResult.cs @@ -0,0 +1,18 @@ +namespace Ombi.Api.TheMovieDb.Models +{ + public class TvSearchResult + { + public string PosterPath { get; set; } + public string Overview { get; set; } + public string ReleaseDate { get; set; } + public int?[] GenreIds { get; set; } + public int Id { get; set; } + public string OriginalName { get; set; } + public string OriginalLanguage { get; set; } + public string Name { get; set; } + public string BackdropPath { get; set; } + public float Popularity { get; set; } + public int VoteCount { get; set; } + public float VoteAverage { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs index 08925e490..ccd0e52e6 100644 --- a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs @@ -42,7 +42,18 @@ public async Task Find(string externalId, ExternalSource source) return await Api.Request(request); } - + + public async Task> SearchTv(string searchTerm) + { + var request = new Request($"search/tv", BaseUri, HttpMethod.Get); + request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken); + request.FullUri = request.FullUri.AddQueryParameter("query", searchTerm); + AddRetry(request); + + var result = await Api.Request>(request); + return Mapper.Map>(result.results); + } + public async Task GetTvExternals(int theMovieDbId) { var request = new Request($"/tv/{theMovieDbId}/external_ids", BaseUri, HttpMethod.Get); diff --git a/src/Ombi/ClientApp/app/requests/requests.module.ts b/src/Ombi/ClientApp/app/requests/requests.module.ts index ca77a853d..7bddee71c 100644 --- a/src/Ombi/ClientApp/app/requests/requests.module.ts +++ b/src/Ombi/ClientApp/app/requests/requests.module.ts @@ -15,7 +15,7 @@ import { TvRequestsComponent } from "./tvrequests.component"; import { SidebarModule, TreeTableModule } from "primeng/primeng"; -import { IdentityService, RadarrService, RequestService, SearchService, SonarrService } from "../services"; +import { IdentityService, RadarrService, RequestService, SonarrService } from "../services"; import { AuthGuard } from "../auth/auth.guard"; @@ -50,7 +50,6 @@ const routes: Routes = [ IdentityService, RequestService, RadarrService, - SearchService, SonarrService, ], diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 68e54d9a4..a73f9c823 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -11,7 +11,7 @@ import "rxjs/add/operator/distinctUntilChanged"; import "rxjs/add/operator/map"; import { AuthService } from "../auth/auth.service"; -import { NotificationService, RequestService, SearchService, SonarrService } from "../services"; +import { NotificationService, RequestService, SonarrService } from "../services"; import { TreeNode } from "primeng/primeng"; import { IIssueCategory, ISonarrProfile, ISonarrRootFolder, ITvRequests } from "../interfaces"; @@ -46,7 +46,6 @@ export class TvRequestsComponent implements OnInit { constructor(private requestService: RequestService, private auth: AuthService, private sanitizer: DomSanitizer, - private searchService: SearchService, private imageService: ImageService, private sonarrService: SonarrService, private notificationService: NotificationService) { @@ -227,15 +226,7 @@ export class TvRequestsComponent implements OnInit { val.data.posterPath = "../../../images/default_tv_poster.png"; } - if (val.data.imdbId.length === 0) { - this.searchService.getShowInformationTreeNode(val.data.tvDbId).subscribe(x => { - if (x.data) { - val.data.imdbId = "https://www.tvmaze.com/shows/" + x.data.seriesId; - } - }); - } else { - val.data.imdbId = "http://www.imdb.com/title/" + val.data.imdbId + "/"; - } + val.data.imdbId = "http://www.imdb.com/title/" + val.data.imdbId + "/"; } private loadBackdrop(val: TreeNode): void { From b9fdc7dae37a40ca0017b0b1eec32b3936aa2eba Mon Sep 17 00:00:00 2001 From: Anojh Date: Tue, 10 Apr 2018 17:56:05 -0700 Subject: [PATCH 13/15] Tidying up variable naming --- src/Ombi.Core/Helpers/TvShowRequestBuilder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs b/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs index e206af5c8..6e4d20be8 100644 --- a/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs +++ b/src/Ombi.Core/Helpers/TvShowRequestBuilder.cs @@ -33,13 +33,13 @@ public TvShowRequestBuilder(ITvMazeApi tvApi, IMovieDbApi movApi) public DateTime FirstAir { get; protected set; } public TvRequests NewRequest { get; protected set; } protected TvMazeShow ShowInfo { get; set; } - protected List Result { get; set; } + protected List Results { get; set; } public async Task GetShowInfo(int id) { ShowInfo = await TvApi.ShowLookupByTheTvDbId(id); - Result = await MovieDbApi.SearchTv(ShowInfo.name); - foreach (TvSearchResult result in Result) { + Results = await MovieDbApi.SearchTv(ShowInfo.name); + foreach (TvSearchResult result in Results) { if (result.Name == ShowInfo.name) { var showIds = await MovieDbApi.GetTvExternals(result.Id); From 0e5a4ca3615d68ef32fe861c571995e40801debf Mon Sep 17 00:00:00 2001 From: Anojh Date: Wed, 11 Apr 2018 07:47:42 -0700 Subject: [PATCH 14/15] Diplay poster in UI now that we have imdbid --- src/Ombi/ClientApp/app/requests/tvrequests.component.html | 2 +- src/Ombi/ClientApp/app/requests/tvrequests.component.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html index 714d8ff3b..9a3c4d186 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html @@ -39,7 +39,7 @@
diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index a73f9c823..344bf5712 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -225,8 +225,6 @@ export class TvRequestsComponent implements OnInit { if (val.data.posterPath === null) { val.data.posterPath = "../../../images/default_tv_poster.png"; } - - val.data.imdbId = "http://www.imdb.com/title/" + val.data.imdbId + "/"; } private loadBackdrop(val: TreeNode): void { From 13465a8f0d9f0369f23c4607027d277accd1b124 Mon Sep 17 00:00:00 2001 From: Anojh Date: Wed, 11 Apr 2018 13:46:18 -0700 Subject: [PATCH 15/15] Created method for reused active class toggling code --- .../app/requests/movierequests.component.ts | 52 +++++++------------ 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/src/Ombi/ClientApp/app/requests/movierequests.component.ts b/src/Ombi/ClientApp/app/requests/movierequests.component.ts index 374761c41..e28b86eaa 100644 --- a/src/Ombi/ClientApp/app/requests/movierequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/movierequests.component.ts @@ -167,22 +167,7 @@ export class MovieRequestsComponent implements OnInit { } public filterAvailability(filter: FilterType, el: any) { - el = el.toElement || el.relatedTarget || el.target || el.srcElement; - - el = el.parentElement; //gets radio div - el = el.parentElement; //gets form group div - el = el.parentElement; //gets status filter div - el = el.querySelectorAll("INPUT"); - for (el of el) { - if (el.checked) { - if (!el.parentElement.classList.contains("active")) { - el.parentElement.className += " active"; - } - } else { - el.parentElement.classList.remove("active"); - } - } - + this.filterActiveStyle(el); this.filter.availabilityFilter = filter; this.requestService.filterMovies(this.filter) .subscribe(x => { @@ -192,22 +177,7 @@ export class MovieRequestsComponent implements OnInit { } public filterStatus(filter: FilterType, el: any) { - el = el.toElement || el.relatedTarget || el.target || el.srcElement; - - el = el.parentElement; //gets radio div - el = el.parentElement; //gets form group div - el = el.parentElement; //gets status filter div - el = el.querySelectorAll("INPUT"); - for (el of el) { - if (el.checked) { - if (!el.parentElement.classList.contains("active")) { - el.parentElement.className += " active"; - } - } else { - el.parentElement.classList.remove("active"); - } - } - + this.filterActiveStyle(el); this.filter.statusFilter = filter; this.requestService.filterMovies(this.filter) .subscribe(x => { @@ -231,6 +201,24 @@ export class MovieRequestsComponent implements OnInit { this.order = value; } + private filterActiveStyle(el: any) { + el = el.toElement || el.relatedTarget || el.target || el.srcElement; + + el = el.parentElement; //gets radio div + el = el.parentElement; //gets form group div + el = el.parentElement; //gets status filter div + el = el.querySelectorAll("INPUT"); + for (el of el) { + if (el.checked) { + if (!el.parentElement.classList.contains("active")) { + el.parentElement.className += " active"; + } + } else { + el.parentElement.classList.remove("active"); + } + } + } + private loadRequests(amountToLoad: number, currentlyLoaded: number) { this.requestService.getMovieRequests(amountToLoad, currentlyLoaded + 1) .subscribe(x => {