diff --git a/README.md b/README.md index 2ff3e0ccd..60f886a72 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ Search the existing requests to see if your suggestion has already been submitte ___ Get it on Google Play
-_**Note:** There is no longer an iOS app due to complications outside of our control._ - +Get it on the App Store +
# Features Here are some of the features Ombi has: diff --git a/src/Ombi.Settings/Settings/Models/External/TheMovieDbSettings.cs b/src/Ombi.Settings/Settings/Models/External/TheMovieDbSettings.cs index fe0c238d8..c2df1b9b3 100644 --- a/src/Ombi.Settings/Settings/Models/External/TheMovieDbSettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/TheMovieDbSettings.cs @@ -7,5 +7,9 @@ namespace Ombi.Core.Settings.Models.External public bool ShowAdultMovies { get; set; } public List ExcludedKeywordIds { get; set; } + + public List ExcludedMovieGenreIds { get; set; } + + public List ExcludedTvGenreIds { get; set; } } } diff --git a/src/Ombi.TheMovieDbApi/IMovieDbApi.cs b/src/Ombi.TheMovieDbApi/IMovieDbApi.cs index ea2465c1d..fb15aab5f 100644 --- a/src/Ombi.TheMovieDbApi/IMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/IMovieDbApi.cs @@ -4,6 +4,10 @@ using System.Threading.Tasks; using Ombi.Api.TheMovieDb.Models; using Ombi.TheMovieDbApi.Models; +// Due to conflicting Genre models in +// Ombi.TheMovieDbApi.Models and Ombi.Api.TheMovieDb.Models +using Genre = Ombi.TheMovieDbApi.Models.Genre; + namespace Ombi.Api.TheMovieDb { public interface IMovieDbApi @@ -34,5 +38,6 @@ namespace Ombi.Api.TheMovieDb Task GetKeyword(int keywordId); Task GetMovieWatchProviders(int theMoviedbId, CancellationToken token); Task GetTvWatchProviders(int theMoviedbId, CancellationToken token); + Task> GetGenres(string media); } -} \ No newline at end of file +} diff --git a/src/Ombi.TheMovieDbApi/Models/TheMovieDbContainer.cs b/src/Ombi.TheMovieDbApi/Models/TheMovieDbContainer.cs index 72f58dd02..5eb5dbeac 100644 --- a/src/Ombi.TheMovieDbApi/Models/TheMovieDbContainer.cs +++ b/src/Ombi.TheMovieDbApi/Models/TheMovieDbContainer.cs @@ -36,4 +36,9 @@ namespace Ombi.TheMovieDbApi.Models public int total_results { get; set; } public int total_pages { get; set; } } -} \ No newline at end of file + + public class GenreContainer + { + public List genres { get; set; } + } +} diff --git a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs index 74c849d59..c5a290e04 100644 --- a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs @@ -13,6 +13,10 @@ using Ombi.Core.Settings.Models.External; using Ombi.Helpers; using Ombi.TheMovieDbApi.Models; +// Due to conflicting Genre models in +// Ombi.TheMovieDbApi.Models and Ombi.Api.TheMovieDb.Models +using Genre = Ombi.TheMovieDbApi.Models.Genre; + namespace Ombi.Api.TheMovieDb { public class TheMovieDbApi : IMovieDbApi @@ -198,6 +202,7 @@ namespace Ombi.Api.TheMovieDb request.AddQueryString("page", page.ToString()); } await AddDiscoverSettings(request); + await AddGenreFilter(request, type); AddRetry(request); var result = await Api.Request>(request, cancellationToken); return Mapper.Map>(result.results); @@ -233,6 +238,7 @@ namespace Ombi.Api.TheMovieDb request.AddQueryString("vote_count.gte", "250"); await AddDiscoverSettings(request); + await AddGenreFilter(request, type); AddRetry(request); var result = await Api.Request>(request); return Mapper.Map>(result.results); @@ -269,6 +275,7 @@ namespace Ombi.Api.TheMovieDb request.AddQueryString("page", page.ToString()); } await AddDiscoverSettings(request); + await AddGenreFilter(request, type); AddRetry(request); var result = await Api.Request>(request); return Mapper.Map>(result.results); @@ -297,6 +304,7 @@ namespace Ombi.Api.TheMovieDb } await AddDiscoverSettings(request); + await AddGenreFilter(request, "movie"); AddRetry(request); var result = await Api.Request>(request); return Mapper.Map>(result.results); @@ -344,6 +352,16 @@ namespace Ombi.Api.TheMovieDb return keyword == null || keyword.Id == 0 ? null : keyword; } + public async Task> GetGenres(string media) + { + var request = new Request($"genre/{media}/list", BaseUri, HttpMethod.Get); + request.AddQueryString("api_key", ApiToken); + AddRetry(request); + + var result = await Api.Request>(request); + return result.genres ?? new List(); + } + public Task> MultiSearch(string searchTerm, string languageCode, CancellationToken cancellationToken) { var request = new Request("search/multi", BaseUri, HttpMethod.Get); @@ -380,6 +398,28 @@ namespace Ombi.Api.TheMovieDb } } + private async Task AddGenreFilter(Request request, string media_type) + { + var settings = await Settings; + List excludedGenres; + + switch (media_type) { + case "tv": + excludedGenres = settings.ExcludedTvGenreIds; + break; + case "movie": + excludedGenres = settings.ExcludedMovieGenreIds; + break; + default: + return; + } + + if (excludedGenres?.Any() == true) + { + request.AddQueryString("without_genres", string.Join(",", excludedGenres)); + } + } + private static void AddRetry(Request request) { request.Retry = true; diff --git a/src/Ombi/ClientApp/src/app/app.component.html b/src/Ombi/ClientApp/src/app/app.component.html index a8e527a6b..351b8ef49 100644 --- a/src/Ombi/ClientApp/src/app/app.component.html +++ b/src/Ombi/ClientApp/src/app/app.component.html @@ -170,7 +170,17 @@
- + diff --git a/src/Ombi/ClientApp/src/app/app.component.ts b/src/Ombi/ClientApp/src/app/app.component.ts index 356107039..038fcc7d7 100644 --- a/src/Ombi/ClientApp/src/app/app.component.ts +++ b/src/Ombi/ClientApp/src/app/app.component.ts @@ -33,6 +33,7 @@ export class AppComponent implements OnInit { public applicationName: string = "Ombi" public isAdmin: boolean; public username: string; + public accessToken: string; private hubConnected: boolean; @@ -55,6 +56,7 @@ export class AppComponent implements OnInit { if (this.authService.loggedIn()) { this.user = this.authService.claims(); this.username = this.user.name; + this.identity.getAccessToken().subscribe(x => this.accessToken = x); if (!this.hubConnected) { this.signalrNotification.initialize(); this.hubConnected = true; diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index d73fdddc8..5dfaa3e15 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -284,6 +284,8 @@ export interface IVoteSettings extends ISettings { export interface ITheMovieDbSettings extends ISettings { showAdultMovies: boolean; excludedKeywordIds: number[]; + excludedMovieGenreIds: number[]; + excludedTvGenreIds: number[] } export interface IUpdateModel diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html index 8bca28fb5..0945c5a51 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html @@ -69,10 +69,11 @@ -
- +
+ +
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.ts index e51414902..d4e8f894c 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.ts @@ -1,9 +1,10 @@ import { Component, Input } from "@angular/core"; import { IChildRequests, RequestType } from "../../../../../interfaces"; -import { RequestService } from "../../../../../services/request.service"; -import { MessageService } from "../../../../../services"; -import { MatDialog } from "@angular/material/dialog"; + import { DenyDialogComponent } from "../../../shared/deny-dialog/deny-dialog.component"; +import { MatDialog } from "@angular/material/dialog"; +import { MessageService } from "../../../../../services"; +import { RequestService } from "../../../../../services/request.service"; import { RequestServiceV2 } from "../../../../../services/requestV2.service"; @Component({ @@ -14,6 +15,7 @@ import { RequestServiceV2 } from "../../../../../services/requestV2.service"; export class TvRequestsPanelComponent { @Input() public tvRequest: IChildRequests[]; @Input() public isAdmin: boolean; + @Input() public manageOwnRequests: boolean; public displayedColumns: string[] = ['number', 'title', 'airDate', 'status']; diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html index d0590ad1b..dc8902a1b 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.html @@ -126,7 +126,7 @@ {{'Requests.Title' | translate}} - + diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts index f9b686a48..7b1c98ba8 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/tv-details.component.ts @@ -27,6 +27,7 @@ export class TvDetailsComponent implements OnInit { public showRequest: ITvRequests; public fromSearch: boolean; public isAdmin: boolean; + public manageOwnRequests: boolean; public advancedOptions: IAdvancedData; public showAdvanced: boolean; // Set on the UI public requestType = RequestType.tvShow; @@ -53,6 +54,7 @@ export class TvDetailsComponent implements OnInit { this.issuesEnabled = this.settingsState.getIssue(); this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); + this.manageOwnRequests = this.auth.hasRole('ManageOwnRequests'); if (this.isAdmin) { this.showAdvanced = await this.sonarrService.isEnabled(); diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html index f73c9bbc8..95f31198b 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.html @@ -28,6 +28,13 @@ + + + +  {{ 'NavigationBar.OpenMobileApp' | translate }} + + diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss index 753759af1..f76109b96 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.scss @@ -107,10 +107,21 @@ margin-right:5px; } +#nav-openMobile { + display: none; +} + @media (max-width: 600px) { .profile-username{ display:none; } + +} + +@media (max-width: 950px) { + #nav-openMobile { + display: block; + } } .profile-img img { diff --git a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts index d65307bdb..57bfaca91 100644 --- a/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts +++ b/src/Ombi/ClientApp/src/app/my-nav/my-nav.component.ts @@ -1,16 +1,17 @@ -import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { INavBar } from '../interfaces/ICommon'; -import { StorageService } from '../shared/storage/storage-service'; -import { SettingsService, SettingsStateService } from '../services'; -import { MatSlideToggleChange } from '@angular/material/slide-toggle'; -import { SearchFilter } from './SearchFilter'; -import { Md5 } from 'ts-md5/dist/md5'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { IUser, RequestType, UserType } from '../interfaces'; +import { SettingsService, SettingsStateService } from '../services'; + import { FilterService } from '../discover/services/filter-service'; import { ILocalUser } from '../auth/IUserLogin'; +import { INavBar } from '../interfaces/ICommon'; +import { MatSlideToggleChange } from '@angular/material/slide-toggle'; +import { Md5 } from 'ts-md5/dist/md5'; +import { Observable } from 'rxjs'; +import { SearchFilter } from './SearchFilter'; +import { StorageService } from '../shared/storage/storage-service'; +import { map } from 'rxjs/operators'; export enum SearchFilterType { Movie = 1, @@ -34,6 +35,8 @@ export class MyNavComponent implements OnInit { @Input() public showNav: boolean; @Input() public applicationName: string; @Input() public applicationLogo: string; + @Input() public applicationUrl: string; + @Input() public accessToken: string; @Input() public username: string; @Input() public isAdmin: string; @Input() public email: string; @@ -122,4 +125,12 @@ export class MyNavComponent implements OnInit { var fallback = this.applicationLogo ? this.applicationLogo : 'https://raw.githubusercontent.com/Ombi-app/Ombi/gh-pages/img/android-chrome-512x512.png'; return `https://www.gravatar.com/avatar/${this.emailHash}?d=${fallback}`; } + + public openMobileApp(event: any) { + event.preventDefault(); + + const url = `ombi://${this.applicationUrl}|${this.accessToken}`; + window.location.assign(url); +} + } diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html index e8926b69a..00cd67d6e 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.html @@ -76,7 +76,7 @@ - + diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts index c73084c2b..69fd0da77 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/movies-grid/movies-grid.component.ts @@ -1,18 +1,18 @@ -import { Component, AfterViewInit, ViewChild, EventEmitter, Output, ChangeDetectorRef, OnInit } from "@angular/core"; +import { AfterViewInit, ChangeDetectorRef, Component, EventEmitter, OnInit, Output, ViewChild } from "@angular/core"; import { IMovieRequests, IRequestEngineResult, IRequestsViewModel } from "../../../interfaces"; -import { MatPaginator } from "@angular/material/paginator"; -import { MatSort } from "@angular/material/sort"; -import { merge, Observable, of as observableOf, forkJoin } from 'rxjs'; +import { NotificationService, RequestService } from "../../../services"; +import { Observable, forkJoin, merge, of as observableOf } from 'rxjs'; import { catchError, map, startWith, switchMap } from 'rxjs/operators'; -import { RequestServiceV2 } from "../../../services/requestV2.service"; import { AuthService } from "../../../auth/auth.service"; -import { StorageService } from "../../../shared/storage/storage-service"; +import { MatPaginator } from "@angular/material/paginator"; +import { MatSort } from "@angular/material/sort"; +import { MatTableDataSource } from "@angular/material/table"; import { RequestFilterType } from "../../models/RequestFilterType"; +import { RequestServiceV2 } from "../../../services/requestV2.service"; import { SelectionModel } from "@angular/cdk/collections"; -import { NotificationService, RequestService } from "../../../services"; +import { StorageService } from "../../../shared/storage/storage-service"; import { TranslateService } from "@ngx-translate/core"; -import { MatTableDataSource } from "@angular/material/table"; @Component({ templateUrl: "./movies-grid.component.html", @@ -26,6 +26,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { public displayedColumns: string[] = ['title', 'requestedUser.requestedBy', 'status', 'requestStatus','requestedDate', 'actions']; public gridCount: string = "15"; public isAdmin: boolean; + public manageOwnRequests: boolean; public defaultSort: string = "requestedDate"; public defaultOrder: string = "desc"; public currentFilter: RequestFilterType = RequestFilterType.All; @@ -39,7 +40,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { private storageKeyGridCount = "Movie_DefaultGridCount"; private storageKeyCurrentFilter = "Movie_DefaultFilter"; - @Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any }>(); + @Output() public onOpenOptions = new EventEmitter<{ request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean }>(); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; @@ -53,6 +54,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { public ngOnInit() { this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); + this.manageOwnRequests = this.auth.hasRole("ManageOwnRequests") if (this.isAdmin) { this.displayedColumns.unshift('select'); } @@ -135,7 +137,7 @@ export class MoviesGridComponent implements OnInit, AfterViewInit { this.ref.detectChanges(); }; - this.onOpenOptions.emit({ request: request, filter: filter, onChange: onChange }); + this.onOpenOptions.emit({ request: request, filter: filter, onChange: onChange, manageOwnRequests: this.manageOwnRequests, isAdmin: this.isAdmin }); } public switchFilter(type: RequestFilterType) { diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html index 399b35e16..ac974ece8 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html +++ b/src/Ombi/ClientApp/src/app/requests-list/components/options/request-options.component.html @@ -1,11 +1,11 @@ - + {{'Requests.RequestPanel.Delete' | translate}} - + {{'Requests.RequestPanel.Approve' | translate}} - + {{'Requests.RequestPanel.ChangeAvailability' | translate}} \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts b/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts index 6cdd84af3..5487a08a1 100644 --- a/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts +++ b/src/Ombi/ClientApp/src/app/requests-list/components/requests-list.component.ts @@ -1,8 +1,9 @@ import { Component, ViewChild } from "@angular/core"; + import { MatBottomSheet } from "@angular/material/bottom-sheet"; +import { MoviesGridComponent } from "./movies-grid/movies-grid.component"; import { RequestOptionsComponent } from "./options/request-options.component"; import { UpdateType } from "../models/UpdateType"; -import { MoviesGridComponent } from "./movies-grid/movies-grid.component"; @Component({ templateUrl: "./requests-list.component.html", @@ -12,7 +13,7 @@ export class RequestsListComponent { constructor(private bottomSheet: MatBottomSheet) { } - public onOpenOptions(event: { request: any, filter: any, onChange: any }) { + public onOpenOptions(event: { request: any, filter: any, onChange: any, manageOwnRequests: boolean, isAdmin: boolean }) { const ref = this.bottomSheet.open(RequestOptionsComponent, { data: { id: event.request.id, type: event.request.requestType, canApprove: event.request.canApprove } }); ref.afterDismissed().subscribe((result) => { diff --git a/src/Ombi/ClientApp/src/app/services/applications/themoviedb.service.ts b/src/Ombi/ClientApp/src/app/services/applications/themoviedb.service.ts index 677034143..ff76d591b 100644 --- a/src/Ombi/ClientApp/src/app/services/applications/themoviedb.service.ts +++ b/src/Ombi/ClientApp/src/app/services/applications/themoviedb.service.ts @@ -22,4 +22,8 @@ export class TheMovieDbService extends ServiceHelpers { return this.http.get(`${this.url}/Keywords/${keywordId}`, { headers: this.headers }) .pipe(catchError((error: HttpErrorResponse) => error.status === 404 ? empty() : throwError(error))); } + + public getGenres(media: string): Observable { + return this.http.get(`${this.url}/Genres/${media}`, { headers: this.headers }) + } } diff --git a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html index 3b3044780..1625c1b77 100644 --- a/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html +++ b/src/Ombi/ClientApp/src/app/settings/customization/customization.component.html @@ -1,4 +1,4 @@ - +
@@ -12,9 +12,8 @@
- The application url should be your Externally Accessible URL for example, your internal URL is http://192.168.1.50/ but your Externally - Accessible URL is 'https://mydomain.com/requests' Please ensure this field is correct as it drives a lot of functionality include the QR code for the - mobile app and it affects the way email notifications are sent. + The application url should be your Externally Accessible URL (the address you use to reach Ombi from outside your system). For example, 'https://example.com/requests'.
Please ensure this field is correct as it drives a lot of functionality, including the QR code for the + mobile app, and the way email notifications are sent.
Application URL @@ -81,4 +80,4 @@ -
\ No newline at end of file + diff --git a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html index 4d47aa8a9..fb10cc142 100644 --- a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html +++ b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.html @@ -15,7 +15,7 @@
- + (removed)="remove(key, 'keyword')"> + {{key.name}} + + + + +
+ + Movie Genres + + + {{genre.name}} + + + +
+ + + + {{key.name}} + + + + +
+ + Tv Genres + + + {{genre.name}} + + + +
+ + + {{key.name}} @@ -52,4 +90,4 @@ - \ No newline at end of file + diff --git a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts index 228d4fc42..49ec3e51f 100644 --- a/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/themoviedb/themoviedb.component.ts @@ -23,8 +23,13 @@ export class TheMovieDbComponent implements OnInit { public settings: ITheMovieDbSettings; public excludedKeywords: IKeywordTag[]; + public excludedMovieGenres: IKeywordTag[]; + public excludedTvGenres: IKeywordTag[]; public tagForm: FormGroup; public filteredTags: IMovieDbKeyword[]; + public filteredMovieGenres: IMovieDbKeyword[]; + public filteredTvGenres: IMovieDbKeyword[]; + @ViewChild('fruitInput') public fruitInput: ElementRef; constructor(private settingsService: SettingsService, @@ -35,9 +40,13 @@ export class TheMovieDbComponent implements OnInit { public ngOnInit() { this.tagForm = this.fb.group({ input: null, + excludedMovieGenres: null, + excludedTvGenres: null, }); this.settingsService.getTheMovieDbSettings().subscribe(settings => { this.settings = settings; + + // Map Keyword ids -> keyword name this.excludedKeywords = settings.excludedKeywordIds ? settings.excludedKeywordIds.map(id => ({ id, @@ -45,13 +54,56 @@ export class TheMovieDbComponent implements OnInit { initial: true, })) : []; - this.excludedKeywords.forEach(key => { - this.tmdbService.getKeyword(key.id).subscribe(keyResult => { - this.excludedKeywords.filter((val, idx) => { - val.name = keyResult.name; - }) + + this.excludedKeywords.forEach(key => { + this.tmdbService.getKeyword(key.id).subscribe(keyResult => { + this.excludedKeywords.filter((val, idx) => { + val.name = keyResult.name; + }) + }); + }); + + // Map Movie Genre ids -> genre name + this.excludedMovieGenres = settings.excludedMovieGenreIds + ? settings.excludedMovieGenreIds.map(id => ({ + id, + name: "", + initial: true, + })) + : []; + + this.tmdbService.getGenres("movie").subscribe(results => { + this.filteredMovieGenres = results; + + this.excludedMovieGenres.forEach(genre => { + results.forEach(result => { + if (genre.id == result.id) { + genre.name = result.name; + } }); }); + }); + + // Map Tv Genre ids -> genre name + this.excludedTvGenres = settings.excludedTvGenreIds + ? settings.excludedTvGenreIds.map(id => ({ + id, + name: "", + initial: true, + })) + : []; + + this.tmdbService.getGenres("tv").subscribe(results => { + this.filteredTvGenres = results; + + this.excludedTvGenres.forEach(genre => { + results.forEach(result => { + if (genre.id == result.id) { + genre.name = result.name; + } + }); + }); + }); }); this.tagForm @@ -65,19 +117,48 @@ export class TheMovieDbComponent implements OnInit { }) ) .subscribe((r) => (this.filteredTags = r)); - } - public remove(tag: IKeywordTag): void { - const index = this.excludedKeywords.indexOf(tag); + public remove(tag: IKeywordTag, tag_type: string): void { + var exclusion_list; + + switch (tag_type) { + case "keyword": + exclusion_list = this.excludedKeywords; + break; + case "movieGenre": + exclusion_list = this.excludedMovieGenres; + break; + case "tvGenre": + exclusion_list = this.excludedTvGenres; + break; + default: + return; + } + + const index = exclusion_list.indexOf(tag); if (index >= 0) { - this.excludedKeywords.splice(index, 1); + exclusion_list.splice(index, 1); } } public save() { + + var selectedMovieGenres: number[] = this.tagForm.controls.excludedMovieGenres.value ?? []; + var selectedTvGenres: number[] = this.tagForm.controls.excludedTvGenres.value ?? []; + + var movieIds: number[] = this.excludedMovieGenres.map(k => k.id); + var tvIds: number[] = this.excludedTvGenres.map(k => k.id) + + // Concat and dedup already excluded genres + newly selected ones + selectedMovieGenres = movieIds.concat(selectedMovieGenres.filter(item => movieIds.indexOf(item) < 0)); + selectedTvGenres = tvIds.concat(selectedTvGenres.filter(item => tvIds.indexOf(item) < 0)); + this.settings.excludedKeywordIds = this.excludedKeywords.map(k => k.id); + this.settings.excludedMovieGenreIds = selectedMovieGenres; + this.settings.excludedTvGenreIds = selectedTvGenres; + this.settingsService.saveTheMovieDbSettings(this.settings).subscribe(x => { if (x) { this.notificationService.success("Successfully saved The Movie Database settings"); diff --git a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html index 0f3dbb082..d513c1f63 100644 --- a/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html +++ b/src/Ombi/ClientApp/src/app/user-preferences/components/user-preference/user-preference.component.html @@ -56,17 +56,17 @@
- Get it on Google Play + Get it on Google Play
- Get it from the App Store + Get it from the App Store
- +
diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html index 74770a3d8..e247f0ea1 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.html @@ -145,13 +145,14 @@
-
+
- +
diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts index bfbabd0a3..c091d3861 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement-user.component.ts @@ -1,9 +1,10 @@ -import { Location } from "@angular/common"; -import { AfterViewInit, Component, OnInit } from "@angular/core"; -import { ActivatedRoute, Router } from "@angular/router"; +import { ActivatedRoute, Router } from "@angular/router"; +import { Component, OnInit } from "@angular/core"; +import { ICheckbox, ICustomizationSettings, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces"; +import { IdentityService, MessageService, RadarrService, SettingsService, SonarrService } from "../services"; -import { ICheckbox, INotificationAgent, INotificationPreferences, IRadarrProfile, IRadarrRootFolder, ISonarrProfile, ISonarrRootFolder, IUser, UserType } from "../interfaces"; -import { IdentityService, RadarrService, SonarrService, MessageService } from "../services"; +import { Clipboard } from '@angular/cdk/clipboard'; +import { Location } from "@angular/common"; @Component({ templateUrl: "./usermanagement-user.component.html", @@ -27,12 +28,17 @@ export class UserManagementUserComponent implements OnInit { public countries: string[]; + private customization: ICustomizationSettings; + private accessToken: string; + constructor(private identityService: IdentityService, private notificationService: MessageService, + private readonly settingsService: SettingsService, private router: Router, private route: ActivatedRoute, private sonarrService: SonarrService, private radarrService: RadarrService, + private clipboard: Clipboard, private location: Location) { this.route.params.subscribe((params: any) => { @@ -60,6 +66,9 @@ export class UserManagementUserComponent implements OnInit { this.radarrService.getQualityProfilesFromSettings().subscribe(x => this.radarrQualities = x); this.radarrService.getRootFoldersFromSettings().subscribe(x => this.radarrRootFolders = x); + this.settingsService.getCustomization().subscribe(x => this.customization = x); + this.identityService.getAccessToken().subscribe(x => this.accessToken = x); + if(!this.edit) { this.user = { alias: "", @@ -178,7 +187,12 @@ export class UserManagementUserComponent implements OnInit { } }); } - + + public async appLink() { + this.clipboard.copy(`ombi://${this.customization.applicationUrl}|${this.accessToken}`); + this.notificationService.send("Copied!"); + } + public back() { this.location.back(); } diff --git a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts index 885e6e2e4..a55702101 100644 --- a/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts +++ b/src/Ombi/ClientApp/src/app/usermanagement/usermanagement.module.ts @@ -1,23 +1,19 @@ -import { CommonModule } from "@angular/common"; -import { NgModule } from "@angular/core"; -import { FormsModule, ReactiveFormsModule } from "@angular/forms"; -import { RouterModule, Routes } from "@angular/router"; -import { ConfirmDialogModule } from "primeng/confirmdialog"; -import { MultiSelectModule } from "primeng/multiselect"; -import { SidebarModule } from "primeng/sidebar"; -import { TooltipModule } from "primeng/tooltip"; - -import { UserManagementUserComponent } from "./usermanagement-user.component"; -import { UserManagementComponent } from "./usermanagement.component"; - -import { PipeModule } from "../pipes/pipe.module"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { IdentityService, PlexService, RadarrService, SonarrService } from "../services"; +import { RouterModule, Routes } from "@angular/router"; import { AuthGuard } from "../auth/auth.guard"; - +import { CommonModule } from "@angular/common"; +import { ConfirmDialogModule } from "primeng/confirmdialog"; +import { MultiSelectModule } from "primeng/multiselect"; +import { NgModule } from "@angular/core"; import { OrderModule } from "ngx-order-pipe"; - +import { PipeModule } from "../pipes/pipe.module"; import { SharedModule } from "../shared/shared.module"; +import { SidebarModule } from "primeng/sidebar"; +import { TooltipModule } from "primeng/tooltip"; +import { UserManagementComponent } from "./usermanagement.component"; +import { UserManagementUserComponent } from "./usermanagement-user.component"; const routes: Routes = [ { path: "", component: UserManagementComponent, canActivate: [AuthGuard] }, diff --git a/src/Ombi/Controllers/V1/External/TheMovieDbController.cs b/src/Ombi/Controllers/V1/External/TheMovieDbController.cs index 714831633..ac4bb4eea 100644 --- a/src/Ombi/Controllers/V1/External/TheMovieDbController.cs +++ b/src/Ombi/Controllers/V1/External/TheMovieDbController.cs @@ -5,6 +5,10 @@ using Ombi.Attributes; using System.Collections.Generic; using System.Threading.Tasks; +// Due to conflicting Genre models in +// Ombi.TheMovieDbApi.Models and Ombi.Api.TheMovieDb.Models +using Genre = Ombi.TheMovieDbApi.Models.Genre; + namespace Ombi.Controllers.External { [Admin] @@ -34,5 +38,13 @@ namespace Ombi.Controllers.External var keyword = await TmdbApi.GetKeyword(keywordId); return keyword == null ? NotFound() : (IActionResult)Ok(keyword); } + + /// + /// Gets the genres for either Tv or Movies depending on media type + /// + /// Either `tv` or `movie`. + [HttpGet("Genres/{media}")] + public async Task> GetGenres(string media) => + await TmdbApi.GetGenres(media); } }