This commit is contained in:
tidusjar 2017-08-23 22:01:32 +01:00
parent ba2fd48067
commit d7f0f61ece
8 changed files with 31 additions and 20 deletions

View file

@ -61,7 +61,7 @@ namespace Ombi.Schedule.Jobs.Plex
public async Task CacheContent() public async Task CacheContent()
{ {
var plexSettings = Plex.GetSettings(); var plexSettings = await Plex.GetSettingsAsync();
if (!plexSettings.Enable) if (!plexSettings.Enable)
{ {
return; return;
@ -222,12 +222,16 @@ namespace Ombi.Schedule.Jobs.Plex
{ {
if (plexSettings.PlexSelectedLibraries.Any()) if (plexSettings.PlexSelectedLibraries.Any())
{ {
// Only get the enabled libs if (plexSettings.PlexSelectedLibraries.Any(x => x.Enabled))
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 // Only get the enabled libs
continue; 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; var lib = PlexApi.GetLibrary(plexSettings.PlexAuthToken, plexSettings.FullUri, dir.key).Result;

View file

@ -71,14 +71,19 @@ namespace Ombi.Schedule.Jobs.Plex
{ {
if (settings.PlexSelectedLibraries.Any()) if (settings.PlexSelectedLibraries.Any())
{ {
// Make sure we have enabled this // Are any enabled?
var keys = settings.PlexSelectedLibraries.Where(x => x.Enabled).Select(x => x.Key.ToString()).ToList(); if (settings.PlexSelectedLibraries.Any(x => x.Enabled))
if (!keys.Contains(section.key))
{ {
// We are not monitoring this lib // Make sure we have enabled this
continue; 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 // Get the episodes
await GetEpisodes(settings, section); await GetEpisodes(settings, section);
} }

View file

@ -40,7 +40,7 @@ namespace Ombi.Settings.Settings
public async Task<T> GetSettingsAsync() public async Task<T> GetSettingsAsync()
{ {
var result = await Repo.GetAsync(EntityName).ConfigureAwait(false); var result = await Repo.GetAsync(EntityName);
if (result == null) if (result == null)
{ {
return new T(); return new T();
@ -94,8 +94,8 @@ namespace Ombi.Settings.Settings
modified.Id = entity.Id; modified.Id = entity.Id;
var globalSettings = new GlobalSettings { SettingsName = EntityName, Content = JsonConvert.SerializeObject(modified, SerializerSettings.Settings), Id = entity.Id }; var globalSettings = new GlobalSettings { SettingsName = EntityName, Content = JsonConvert.SerializeObject(modified, SerializerSettings.Settings), Id = entity.Id };
entity.Content = EncryptSettings(globalSettings); globalSettings.Content = EncryptSettings(globalSettings);
await Repo.UpdateAsync(entity).ConfigureAwait(false); await Repo.UpdateAsync(globalSettings).ConfigureAwait(false);
return true; return true;
} }
@ -117,7 +117,7 @@ namespace Ombi.Settings.Settings
{ {
await Repo.DeleteAsync(entity); await Repo.DeleteAsync(entity);
} }
} }
private string EncryptSettings(GlobalSettings settings) private string EncryptSettings(GlobalSettings settings)

View file

@ -31,5 +31,7 @@ namespace Ombi.Store.Context
DbSet<MovieIssues> MovieIssues { get; set; } DbSet<MovieIssues> MovieIssues { get; set; }
DbSet<TvIssues> TvIssues { get; set; } DbSet<TvIssues> TvIssues { get; set; }
DbSet<Tokens> Tokens { get; set; } DbSet<Tokens> Tokens { get; set; }
EntityEntry Update(object entity);
EntityEntry<TEntity> Update<TEntity>(TEntity entity) where TEntity : class;
} }
} }

View file

@ -19,7 +19,7 @@ namespace Ombi.Store.Context
Database.Migrate(); Database.Migrate();
// Add the notifcation templates // Add the notifcation templates
} }

View file

@ -63,7 +63,7 @@ namespace Ombi.Store.Repository
{ {
var obj = await Db.Settings.FirstOrDefaultAsync(x => x.SettingsName == settingsName); var obj = await Db.Settings.FirstOrDefaultAsync(x => x.SettingsName == settingsName);
Db.Entry(obj).Reload(); if (obj != null) Db.Entry(obj).Reload();
return obj; return obj;
} }

View file

@ -24,7 +24,7 @@
<ng-template ngbTabContent> <ng-template ngbTabContent>
<br /> <br />
<br /> <br />
<div class="col-md-12 col-md-push-10" style="float: right;"> <div class="col-md-2 " style="float: right;">
<button type="submit" (click)="removeServer(server)" class="btn btn-danger-outline">Remove Server</button> <button type="submit" (click)="removeServer(server)" class="btn btn-danger-outline">Remove Server</button>
</div> </div>
<br /> <br />

View file

@ -27,7 +27,7 @@
<ng-template ngbTabContent> <ng-template ngbTabContent>
<br /> <br />
<br /> <br />
<div class="col-md-12 col-md-push-10" style="float: right;"> <div class="col-md-2 " style="float: right;">
<button type="submit" (click)="removeServer(server)" class="btn btn-danger-outline">Remove Server</button> <button type="submit" (click)="removeServer(server)" class="btn btn-danger-outline">Remove Server</button>
</div> </div>
<br /> <br />