diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs index cda4b1d21..92a503429 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentCacher.cs @@ -61,7 +61,7 @@ namespace Ombi.Schedule.Jobs.Plex public async Task CacheContent() { - var plexSettings = Plex.GetSettings(); + var plexSettings = await Plex.GetSettingsAsync(); if (!plexSettings.Enable) { return; @@ -222,12 +222,16 @@ namespace Ombi.Schedule.Jobs.Plex { if (plexSettings.PlexSelectedLibraries.Any()) { - // Only get the enabled libs - var keys = plexSettings.PlexSelectedLibraries.Where(x => x.Enabled).Select(x => x.Key.ToString()).ToList(); - if (!keys.Contains(dir.key)) + if (plexSettings.PlexSelectedLibraries.Any(x => x.Enabled)) { - // We are not monitoring this lib - continue; + // Only get the enabled libs + var keys = plexSettings.PlexSelectedLibraries.Where(x => x.Enabled) + .Select(x => x.Key.ToString()).ToList(); + if (!keys.Contains(dir.key)) + { + // We are not monitoring this lib + continue; + } } } var lib = PlexApi.GetLibrary(plexSettings.PlexAuthToken, plexSettings.FullUri, dir.key).Result; diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeCacher.cs b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeCacher.cs index d65e7166a..dd243de6b 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeCacher.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeCacher.cs @@ -71,14 +71,19 @@ namespace Ombi.Schedule.Jobs.Plex { if (settings.PlexSelectedLibraries.Any()) { - // Make sure we have enabled this - var keys = settings.PlexSelectedLibraries.Where(x => x.Enabled).Select(x => x.Key.ToString()).ToList(); - if (!keys.Contains(section.key)) + // Are any enabled? + if (settings.PlexSelectedLibraries.Any(x => x.Enabled)) { - // We are not monitoring this lib - continue; + // Make sure we have enabled this + var keys = settings.PlexSelectedLibraries.Where(x => x.Enabled).Select(x => x.Key.ToString()) + .ToList(); + if (!keys.Contains(section.key)) + { + // We are not monitoring this lib + continue; + } } - + // Get the episodes await GetEpisodes(settings, section); } diff --git a/src/Ombi.Settings/Settings/SettingsService.cs b/src/Ombi.Settings/Settings/SettingsService.cs index a6777fdfc..18201f287 100644 --- a/src/Ombi.Settings/Settings/SettingsService.cs +++ b/src/Ombi.Settings/Settings/SettingsService.cs @@ -40,7 +40,7 @@ namespace Ombi.Settings.Settings public async Task GetSettingsAsync() { - var result = await Repo.GetAsync(EntityName).ConfigureAwait(false); + var result = await Repo.GetAsync(EntityName); if (result == null) { return new T(); @@ -94,8 +94,8 @@ namespace Ombi.Settings.Settings modified.Id = entity.Id; var globalSettings = new GlobalSettings { SettingsName = EntityName, Content = JsonConvert.SerializeObject(modified, SerializerSettings.Settings), Id = entity.Id }; - entity.Content = EncryptSettings(globalSettings); - await Repo.UpdateAsync(entity).ConfigureAwait(false); + globalSettings.Content = EncryptSettings(globalSettings); + await Repo.UpdateAsync(globalSettings).ConfigureAwait(false); return true; } @@ -117,7 +117,7 @@ namespace Ombi.Settings.Settings { await Repo.DeleteAsync(entity); } - + } private string EncryptSettings(GlobalSettings settings) diff --git a/src/Ombi.Store/Context/IOmbiContext.cs b/src/Ombi.Store/Context/IOmbiContext.cs index af77a73d3..bb00bd8a1 100644 --- a/src/Ombi.Store/Context/IOmbiContext.cs +++ b/src/Ombi.Store/Context/IOmbiContext.cs @@ -31,5 +31,7 @@ namespace Ombi.Store.Context DbSet MovieIssues { get; set; } DbSet TvIssues { get; set; } DbSet Tokens { get; set; } + EntityEntry Update(object entity); + EntityEntry Update(TEntity entity) where TEntity : class; } } \ No newline at end of file diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs index 057a6e91b..81502e6ee 100644 --- a/src/Ombi.Store/Context/OmbiContext.cs +++ b/src/Ombi.Store/Context/OmbiContext.cs @@ -19,7 +19,7 @@ namespace Ombi.Store.Context Database.Migrate(); // Add the notifcation templates - + } diff --git a/src/Ombi.Store/Repository/SettingsJsonRepository.cs b/src/Ombi.Store/Repository/SettingsJsonRepository.cs index 6e2db9ebd..5b7c750ca 100644 --- a/src/Ombi.Store/Repository/SettingsJsonRepository.cs +++ b/src/Ombi.Store/Repository/SettingsJsonRepository.cs @@ -63,7 +63,7 @@ namespace Ombi.Store.Repository { var obj = await Db.Settings.FirstOrDefaultAsync(x => x.SettingsName == settingsName); - Db.Entry(obj).Reload(); + if (obj != null) Db.Entry(obj).Reload(); return obj; } diff --git a/src/Ombi/ClientApp/app/settings/emby/emby.component.html b/src/Ombi/ClientApp/app/settings/emby/emby.component.html index f64f7dbd0..1ecb4bb1c 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.html +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.html @@ -24,7 +24,7 @@

-
+

diff --git a/src/Ombi/ClientApp/app/settings/plex/plex.component.html b/src/Ombi/ClientApp/app/settings/plex/plex.component.html index 8f2b19328..4777c3538 100644 --- a/src/Ombi/ClientApp/app/settings/plex/plex.component.html +++ b/src/Ombi/ClientApp/app/settings/plex/plex.component.html @@ -27,7 +27,7 @@

-
+