-
Changes to any of the below requires you to restart Ombi.
+
Changes to any of the below requires you to restart Ombi.
+
You can generate valid CRON Expressions here: http://www.cronmaker.com/
@@ -121,9 +122,3 @@
-
-
-
- - {{item | date:'short'}}
-
-
diff --git a/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.ts b/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.ts
index 747a4bfde..1a543f885 100644
--- a/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.ts
+++ b/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.ts
@@ -3,8 +3,6 @@
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { NotificationService, SettingsService } from "../../services";
-import { ICronTestModel } from "../../interfaces";
-
@Component({
templateUrl: "./jobs.component.html",
})
@@ -13,8 +11,6 @@ export class JobsComponent implements OnInit {
public form: FormGroup;
public profilesRunning: boolean;
- public testModel: ICronTestModel;
- public displayTest: boolean;
constructor(private readonly settingsService: SettingsService,
private readonly fb: FormBuilder,
@@ -44,9 +40,8 @@ export class JobsComponent implements OnInit {
public testCron(expression: string) {
this.settingsService.testCron({ expression }).subscribe(x => {
- if(x.success) {
- this.testModel = x;
- this.displayTest = true;
+ if(x.success) {
+ this.notificationService.success("Cron is Valid");
} else {
this.notificationService.error(x.message);
}
diff --git a/src/Ombi/Controllers/V1/JobController.cs b/src/Ombi/Controllers/V1/JobController.cs
index f366c4ef3..3411422ac 100644
--- a/src/Ombi/Controllers/V1/JobController.cs
+++ b/src/Ombi/Controllers/V1/JobController.cs
@@ -1,13 +1,16 @@
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Hangfire;
using Microsoft.AspNetCore.Mvc;
using Ombi.Attributes;
using Ombi.Helpers;
+using Ombi.Schedule;
using Ombi.Schedule.Jobs;
using Ombi.Schedule.Jobs.Emby;
using Ombi.Schedule.Jobs.Ombi;
using Ombi.Schedule.Jobs.Plex;
+using Quartz;
namespace Ombi.Controllers.V1
{
@@ -17,35 +20,23 @@ namespace Ombi.Controllers.V1
[ApiController]
public class JobController : ControllerBase
{
- public JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter,
- ICacheService mem, IEmbyUserImporter embyImporter, IPlexContentSync plexContentSync,
- IEmbyContentSync embyContentSync, INewsletterJob newsletter)
+ public JobController(IOmbiAutomaticUpdater updater, ICacheService mem)
{
_updater = updater;
- _plexUserImporter = userImporter;
- _embyUserImporter = embyImporter;
_memCache = mem;
- _plexContentSync = plexContentSync;
- _embyContentSync = embyContentSync;
- _newsletterJob = newsletter;
}
private readonly IOmbiAutomaticUpdater _updater;
- private readonly IPlexUserImporter _plexUserImporter;
- private readonly IEmbyUserImporter _embyUserImporter;
private readonly ICacheService _memCache;
- private readonly IPlexContentSync _plexContentSync;
- private readonly IEmbyContentSync _embyContentSync;
- private readonly INewsletterJob _newsletterJob;
-
///
/// Runs the update job
///
///
[HttpPost("update")]
- public bool ForceUpdate()
+ public async Task
ForceUpdate()
{
- BackgroundJob.Enqueue(() => _updater.Update(null));
+
+ await OmbiQuartz.TriggerJob(nameof(IOmbiAutomaticUpdater), "System");
return true;
}
@@ -92,9 +83,9 @@ namespace Ombi.Controllers.V1
///
///
[HttpPost("plexuserimporter")]
- public bool PlexUserImporter()
+ public async Task PlexUserImporter()
{
- BackgroundJob.Enqueue(() => _plexUserImporter.Start());
+ await OmbiQuartz.TriggerJob(nameof(IPlexUserImporter), "Plex");
return true;
}
@@ -103,9 +94,9 @@ namespace Ombi.Controllers.V1
///
///
[HttpPost("embyuserimporter")]
- public bool EmbyUserImporter()
+ public async Task EmbyUserImporter()
{
- BackgroundJob.Enqueue(() => _embyUserImporter.Start());
+ await OmbiQuartz.TriggerJob(nameof(IEmbyUserImporter), "Emby");
return true;
}
@@ -116,7 +107,7 @@ namespace Ombi.Controllers.V1
[HttpPost("plexcontentcacher")]
public bool StartPlexContentCacher()
{
- BackgroundJob.Enqueue(() => _plexContentSync.CacheContent(false));
+ OmbiQuartz.Scheduler.TriggerJob(new JobKey(nameof(IPlexContentSync), "Plex"), new JobDataMap(new Dictionary { { "recentlyAddedSearch", "false" } }));
return true;
}
@@ -127,7 +118,7 @@ namespace Ombi.Controllers.V1
[HttpPost("plexrecentlyadded")]
public bool StartRecentlyAdded()
{
- BackgroundJob.Enqueue(() => _plexContentSync.CacheContent(true));
+ OmbiQuartz.Scheduler.TriggerJob(new JobKey(nameof(IPlexContentSync), "Plex"), new JobDataMap(new Dictionary { { "recentlyAddedSearch", "true" } }));
return true;
}
@@ -136,9 +127,9 @@ namespace Ombi.Controllers.V1
///
///
[HttpPost("embycontentcacher")]
- public bool StartEmbyContentCacher()
+ public async Task StartEmbyContentCacher()
{
- BackgroundJob.Enqueue(() => _embyContentSync.Start());
+ await OmbiQuartz.TriggerJob(nameof(IEmbyContentSync), "Emby");
return true;
}
@@ -147,9 +138,9 @@ namespace Ombi.Controllers.V1
///
///
[HttpPost("newsletter")]
- public bool StartNewsletter()
+ public async Task StartNewsletter()
{
- BackgroundJob.Enqueue(() => _newsletterJob.Start());
+ await OmbiQuartz.TriggerJob(nameof(INewsletterJob), "System");
return true;
}
}
diff --git a/src/Ombi/Controllers/V1/SearchController.cs b/src/Ombi/Controllers/V1/SearchController.cs
index 4bac34964..d969c5102 100644
--- a/src/Ombi/Controllers/V1/SearchController.cs
+++ b/src/Ombi/Controllers/V1/SearchController.cs
@@ -361,6 +361,19 @@ namespace Ombi.Controllers.V1
return await MusicEngine.SearchAlbum(searchTerm);
}
+ ///
+ /// Returns the album information specified by the foreignAlbumId passed in
+ ///
+ /// We use Lidarr as the Provider
+ ///
+ [HttpGet("music/album/info/{foreignAlbumId}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesDefaultResponseType]
+ public async Task GetAlbumInformation(string foreignAlbumId)
+ {
+ return await MusicEngine.GetAlbumInformation(foreignAlbumId);
+ }
+
///
/// Returns all albums for the artist using the ForeignArtistId
///
diff --git a/src/Ombi/Controllers/V1/SettingsController.cs b/src/Ombi/Controllers/V1/SettingsController.cs
index d7edc2278..c5916a078 100644
--- a/src/Ombi/Controllers/V1/SettingsController.cs
+++ b/src/Ombi/Controllers/V1/SettingsController.cs
@@ -27,6 +27,10 @@ using Ombi.Settings.Settings.Models.External;
using Ombi.Settings.Settings.Models.Notifications;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
+using Ombi.Api.Github;
+using Ombi.Core.Engine;
+using Ombi.Schedule;
+using Quartz;
namespace Ombi.Controllers.V1
{
@@ -44,7 +48,6 @@ namespace Ombi.Controllers.V1
IMapper mapper,
INotificationTemplatesRepository templateRepo,
IEmbyApi embyApi,
- IRadarrSync radarrSync,
ICacheService memCache,
IGithubApi githubApi,
IRecentlyAddedEngine engine)
@@ -53,7 +56,6 @@ namespace Ombi.Controllers.V1
Mapper = mapper;
TemplateRepository = templateRepo;
_embyApi = embyApi;
- _radarrSync = radarrSync;
_cache = memCache;
_githubApi = githubApi;
_recentlyAdded = engine;
@@ -63,7 +65,6 @@ namespace Ombi.Controllers.V1
private IMapper Mapper { get; }
private INotificationTemplatesRepository TemplateRepository { get; }
private readonly IEmbyApi _embyApi;
- private readonly IRadarrSync _radarrSync;
private readonly ICacheService _cache;
private readonly IGithubApi _githubApi;
private readonly IRecentlyAddedEngine _recentlyAdded;
@@ -408,7 +409,8 @@ namespace Ombi.Controllers.V1
{
_cache.Remove(CacheKeys.RadarrRootProfiles);
_cache.Remove(CacheKeys.RadarrQualityProfiles);
- BackgroundJob.Enqueue(() => _radarrSync.CacheContent());
+
+ await OmbiQuartz.TriggerJob(nameof(IRadarrSync), "DVR");
}
return result;
}
@@ -568,8 +570,8 @@ namespace Ombi.Controllers.V1
try
{
- var r = CrontabSchedule.TryParse(expression);
- if (r == null)
+ var isValid = CronExpression.IsValidExpression(expression);
+ if (!isValid)
{
return new JobSettingsViewModel
{
@@ -599,14 +601,15 @@ namespace Ombi.Controllers.V1
var model = new CronTestModel();
try
{
- var time = DateTime.UtcNow;
- var result = CrontabSchedule.TryParse(body.Expression);
- for (int i = 0; i < 10; i++)
+ var isValid = CronExpression.IsValidExpression(body.Expression);
+ if (!isValid)
{
- var next = result.GetNextOccurrence(time);
- model.Schedule.Add(next);
- time = next;
+ return new CronTestModel
+ {
+ Message = $"CRON Expression {body.Expression} is not valid"
+ };
}
+
model.Success = true;
return model;
}
@@ -617,8 +620,6 @@ namespace Ombi.Controllers.V1
Message = $"CRON Expression {body.Expression} is not valid"
};
}
-
-
}
diff --git a/src/Ombi/Models/CronTestModel.cs b/src/Ombi/Models/CronTestModel.cs
index 9698afbff..d8193aef5 100644
--- a/src/Ombi/Models/CronTestModel.cs
+++ b/src/Ombi/Models/CronTestModel.cs
@@ -7,6 +7,5 @@ namespace Ombi.Models
{
public bool Success { get; set; }
public string Message { get; set; }
- public List Schedule { get; set; } = new List();
}
}
\ No newline at end of file
diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs
index 390fc9087..bef289236 100644
--- a/src/Ombi/Startup.cs
+++ b/src/Ombi/Startup.cs
@@ -136,6 +136,8 @@ namespace Ombi
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
+ app.UseQuartz().GetAwaiter().GetResult();
+
var ctx = serviceProvider.GetService();
loggerFactory.AddSerilog();
@@ -194,8 +196,8 @@ namespace Ombi
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute {Attempts = 3});
// Setup the scheduler
- var jobSetup = app.ApplicationServices.GetService();
- jobSetup.Setup();
+ //var jobSetup = app.ApplicationServices.GetService();
+ //jobSetup.Setup();
ctx.Seed();
var settingsctx = serviceProvider.GetService();
var externalctx = serviceProvider.GetService();
diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json
index bfdf6d5bf..e764dde36 100644
--- a/src/Ombi/wwwroot/translations/en.json
+++ b/src/Ombi/wwwroot/translations/en.json
@@ -78,8 +78,9 @@
"ViewOnPlex": "View On Plex",
"ViewOnEmby": "View On Emby",
"RequestAdded": "Request for {{title}} has been added successfully",
- "Similar": "Similar",
- "Refine": "Refine",
+ "Similar":"Similar",
+ "Refine":"Refine",
+ "SearchBarPlaceholder":"Type Here to Search",
"Movies": {
"PopularMovies": "Popular Movies",
"UpcomingMovies": "Upcoming Movies",