From b82dd4c52957fe92d156047c6bc9733e26a8a0ea Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Tue, 8 Aug 2017 16:16:02 +0100 Subject: [PATCH] Made a start on supporting multiple emby servers, the UI needs rework #865 --- src/Ombi.DependencyInjection/IocExtensions.cs | 1 + src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs | 15 +++++++++++---- .../Settings/Models/External/EmbySettings.cs | 11 +++++++++-- src/Ombi/ClientApp/app/interfaces/ISettings.ts | 8 ++++++-- .../app/settings/emby/emby.component.html | 4 +++- .../app/settings/plex/plex.component.html | 8 ++++---- .../app/settings/settingsmenu.component.html | 8 ++++---- 7 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index 45c2fb0fd..6126e188f 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -35,6 +35,7 @@ using Ombi.Core.Rule.Interfaces; using Ombi.Core.Senders; using Ombi.Schedule.Ombi; using Ombi.Store.Repository.Requests; +using PlexContentCacher = Ombi.Schedule.Jobs.Plex.PlexContentCacher; namespace Ombi.DependencyInjection { diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs index 90a0c90f9..d90d419b4 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs @@ -38,9 +38,9 @@ using Ombi.Helpers; using Ombi.Store.Entities; using Ombi.Store.Repository; -namespace Ombi.Schedule.Jobs +namespace Ombi.Schedule.Jobs.Plex { - public partial class PlexContentCacher : IPlexContentCacher + public class PlexContentCacher : IPlexContentCacher { public PlexContentCacher(ISettingsService plex, IPlexApi plexApi, ILogger logger, IPlexContentRepository repo) { @@ -89,7 +89,7 @@ namespace Ombi.Schedule.Jobs var contentToAdd = new List(); foreach (var content in allContent) { - if (content.viewGroup.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase)) + if (content.viewGroup.Equals(Jobs.PlexContentCacher.PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase)) { // Process Shows foreach (var show in content.Metadata) @@ -157,7 +157,7 @@ namespace Ombi.Schedule.Jobs } } } - if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase)) + if (content.viewGroup.Equals(Jobs.PlexContentCacher.PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase)) { foreach (var movie in content.Metadata) { @@ -198,6 +198,13 @@ namespace Ombi.Schedule.Jobs } } + /// + /// Gets all the library sections. + /// If the user has specified only certain libraries then we will only look for those + /// If they have not set the settings then we will monitor them all + /// + /// The plex settings. + /// private List GetAllContent(PlexServers plexSettings) { var sections = PlexApi.GetLibrarySections(plexSettings.PlexAuthToken, plexSettings.FullUri).Result; diff --git a/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs b/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs index b68cbe9d8..1f96e5f50 100644 --- a/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs @@ -1,8 +1,15 @@ -namespace Ombi.Core.Settings.Models.External +using System.Collections.Generic; + +namespace Ombi.Core.Settings.Models.External { - public sealed class EmbySettings : ExternalSettings + public sealed class EmbySettings : Ombi.Settings.Settings.Models.Settings { public bool Enable { get; set; } + public List Servers { get; set; } + } + + public class EmbyServers : ExternalSettings + { 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 f3883d177..f60239cc2 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -19,9 +19,13 @@ export interface IOmbiSettings extends ISettings { allowExternalUsersToAuthenticate:boolean, } -export interface IEmbySettings extends IExternalSettings { - apiKey: string, +export interface IEmbySettings extends ISettings { enable: boolean, + servers: IEmbyServer[] +} + +export interface IEmbyServer extends IExternalSettings { + 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 d65c72d67..693dcdb17 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.html +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.html @@ -2,7 +2,9 @@
- Emby Configuration + Emby Configuration + (UNDER CONSTRUCTION ) +
diff --git a/src/Ombi/ClientApp/app/settings/plex/plex.component.html b/src/Ombi/ClientApp/app/settings/plex/plex.component.html index 428889515..8f2b19328 100644 --- a/src/Ombi/ClientApp/app/settings/plex/plex.component.html +++ b/src/Ombi/ClientApp/app/settings/plex/plex.component.html @@ -11,7 +11,7 @@
- +
@@ -93,7 +93,7 @@
- +
@@ -101,7 +101,7 @@
- +
@@ -136,7 +136,7 @@
- +
diff --git a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html index de9a5c16f..11791d7f4 100644 --- a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html +++ b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html @@ -47,7 +47,7 @@
  • Discord
  • Slack
  • Pushbullet
  • -
  • Pushover
  • + @@ -57,9 +57,9 @@ System