diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyContentCacher.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyContentCacher.cs index 729a55393..c8fad858a 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyContentCacher.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyContentCacher.cs @@ -16,10 +16,13 @@ namespace Ombi.Schedule.Jobs.Emby { if (emby.Enable) { - if (emby?.Ip == null || string.IsNullOrEmpty(emby?.ApiKey)) + foreach (var server in emby.Servers) { - //Log.Warn("A setting is null, Ensure Emby is configured correctly, and we have a Emby Auth token."); - return false; + if (server?.Ip == null || string.IsNullOrEmpty(server?.ApiKey)) + { + //Log.Warn("A setting is null, Ensure Emby is configured correctly, and we have a Emby Auth token."); + return false; + } } } return emby.Enable; diff --git a/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs b/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs index 1f96e5f50..b6b130438 100644 --- a/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs @@ -10,6 +10,7 @@ namespace Ombi.Core.Settings.Models.External public class EmbyServers : ExternalSettings { + public string Name { get; set; } public string ApiKey { get; set; } public string AdministratorId { get; set; } public bool EnableEpisodeSearching { get; set; } diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index f60239cc2..d140a8991 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -25,6 +25,7 @@ export interface IEmbySettings extends ISettings { } export interface IEmbyServer extends IExternalSettings { + name:string, apiKey: string, administratorId: string, enableEpisodeSearching: boolean, diff --git a/src/Ombi/ClientApp/app/settings/emby/emby.component.html b/src/Ombi/ClientApp/app/settings/emby/emby.component.html index 693dcdb17..f64f7dbd0 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.html +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.html @@ -2,63 +2,87 @@
- Emby Configuration - (UNDER CONSTRUCTION ) + + Emby Configuration - -
-
- - -
-
-
- -
- +
+
+
+ + +
-
- -
- -
- +
+
-
-
- - -
-
+ +
+ + +
+
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
-
-
+
+ +
+ +
+
+
+
+ + +
+
- - +
+
-
-
+ + -
- -
- -
-
+
+
-
-
- -
-
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
diff --git a/src/Ombi/ClientApp/app/settings/emby/emby.component.ts b/src/Ombi/ClientApp/app/settings/emby/emby.component.ts index b4d5f4ff9..734807bb6 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.ts +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { IEmbySettings } from '../../interfaces/ISettings' +import { IEmbySettings, IEmbyServer } from '../../interfaces/ISettings' import { SettingsService } from '../../services/settings.service'; import { NotificationService } from "../../services/notification.service"; @@ -18,6 +18,13 @@ export class EmbyComponent implements OnInit { this.settingsService.getEmby().subscribe(x => this.settings = x); } + addTab() { + if (this.settings.servers == null) { + this.settings.servers = []; + } + this.settings.servers.push({ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1), apiKey: "", administratorId: "", enableEpisodeSearching: false, ip: "", port: 0, ssl: false, subDir: "" }); + } + test() { // TODO Emby Service } diff --git a/src/Ombi/ClientApp/app/settings/plex/plex.component.ts b/src/Ombi/ClientApp/app/settings/plex/plex.component.ts index 14d26dacb..8d9571a9c 100644 --- a/src/Ombi/ClientApp/app/settings/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/settings/plex/plex.component.ts @@ -62,10 +62,9 @@ export class PlexComponent implements OnInit, OnDestroy { addTab() { if (this.settings.servers == null) { this.settings.servers = []; - this.settings.servers.push({ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1) }); - } else { - this.notificationService.warning("Disabled", "Support for multiple servers is not available yet"); - } + } + this.settings.servers.push({ name: "New*", id: Math.floor(Math.random() * (99999 - 0 + 1) + 1) }); + } removeServer(server: IPlexServer) { diff --git a/src/Ombi/ClientApp/app/wizard/emby/emby.component.html b/src/Ombi/ClientApp/app/wizard/emby/emby.component.html index 4d09751dc..98f11cbcd 100644 --- a/src/Ombi/ClientApp/app/wizard/emby/emby.component.html +++ b/src/Ombi/ClientApp/app/wizard/emby/emby.component.html @@ -4,36 +4,40 @@

Emby Authentication

-
-
- -
- -
-
+
+
+
+
+ +
+ +
+
-
- +
+ -
- -
-
-
-
- +
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+
+ Next
+
+
-
- -
- -
-
-
- Next
-
-
\ No newline at end of file diff --git a/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts b/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts index 4d151670e..63db265df 100644 --- a/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts +++ b/src/Ombi/ClientApp/app/wizard/emby/emby.component.ts @@ -19,16 +19,22 @@ export class EmbyComponent implements OnInit { ngOnInit(): void { this.embySettings = { - administratorId: "", - apiKey: "", + servers: [], + id:0, enable: true, - enableEpisodeSearching: true, - id: 0, + } + this.embySettings.servers.push({ ip: "", + administratorId: "", + id: 0, + apiKey: "", + enableEpisodeSearching: false, + name: "Default", port: 8096, ssl: false, - subDir:"" - } + subDir: "", + + }) } private embySettings: IEmbySettings; @@ -36,7 +42,7 @@ export class EmbyComponent implements OnInit { save() { this.embyService.logIn(this.embySettings).subscribe(x => { - if (x == null || !x.apiKey) { + if (x == null || !x.servers[0].apiKey) { this.notificationService.error("Could Not Authenticate", "Username or password was incorrect. Could not authenticate with Emby."); return; } diff --git a/src/Ombi/Controllers/External/EmbyController.cs b/src/Ombi/Controllers/External/EmbyController.cs index 48ab27152..1ae68eb31 100644 --- a/src/Ombi/Controllers/External/EmbyController.cs +++ b/src/Ombi/Controllers/External/EmbyController.cs @@ -41,15 +41,16 @@ namespace Ombi.Controllers.External { // Check if settings exist since we allow anon... var settings = await EmbySettings.GetSettingsAsync(); - if (!string.IsNullOrEmpty(settings?.ApiKey)) return null; + if (settings?.Servers?.Any() ?? false) return null; request.Enable = true; + var firstServer = request.Servers.FirstOrDefault(); // Test that we can connect - var result = await EmbyApi.GetUsers(request.FullUri, request.ApiKey); + var result = await EmbyApi.GetUsers(firstServer.FullUri, firstServer.ApiKey); if (result != null && result.Any()) { - request.AdministratorId = result.FirstOrDefault(x => x.Policy.IsAdministrator)?.Id ?? string.Empty; + firstServer.AdministratorId = result.FirstOrDefault(x => x.Policy.IsAdministrator)?.Id ?? string.Empty; await EmbySettings.SaveSettingsAsync(request); return request;