job structure cleanup.

This commit is contained in:
kay.one 2013-03-04 21:20:47 -08:00
parent 5e77d51510
commit eaf6f94c02
35 changed files with 47 additions and 19 deletions

View File

@ -8,6 +8,7 @@ using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Common;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model;
@ -18,9 +19,9 @@ namespace NzbDrone.Api.Series
{
private readonly ISeriesService _seriesService;
private readonly ISeriesRepository _seriesRepository;
private readonly JobController _jobProvider;
private readonly IJobController _jobProvider;
public SeriesModule(ISeriesService seriesService,ISeriesRepository seriesRepository, JobController jobProvider)
public SeriesModule(ISeriesService seriesService,ISeriesRepository seriesRepository, IJobController jobProvider)
: base("/Series")
{
_seriesService = seriesService;
@ -60,7 +61,7 @@ namespace NzbDrone.Api.Series
//We also need to remove any special characters from the filename before attempting to create it
_seriesService.AddSeries(request.Title, request.Path, request.TvDbId, request.QualityProfileId, null);
_jobProvider.QueueJob(typeof(ImportNewSeriesJob));
_jobProvider.Enqueue(typeof(ImportNewSeriesJob));
return new Response { StatusCode = HttpStatusCode.Created };
}
@ -89,7 +90,7 @@ namespace NzbDrone.Api.Series
_seriesRepository.Update(series);
if (oldPath != series.Path)
_jobProvider.QueueJob(typeof(DiskScanJob), new { SeriesId = series.Id });
_jobProvider.Enqueue(typeof(DiskScanJob), new { SeriesId = series.Id });
_seriesRepository.Update(series);
@ -99,7 +100,7 @@ namespace NzbDrone.Api.Series
private Response DeleteSeries(int id)
{
var deleteFiles = Convert.ToBoolean(Request.Headers["deleteFiles"].FirstOrDefault());
_jobProvider.QueueJob(typeof(DeleteSeriesJob), new { SeriesId = id, DeleteFiles = deleteFiles });
_jobProvider.Enqueue(typeof(DeleteSeriesJob), new { SeriesId = id, DeleteFiles = deleteFiles });
return new Response { StatusCode = HttpStatusCode.OK };
}
}

View File

@ -7,6 +7,7 @@ using Moq;
using NCrunch.Framework;
using NUnit.Framework;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;

View File

@ -10,6 +10,7 @@ using NCrunch.Framework;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework;

View File

@ -2,6 +2,7 @@
using System.Linq;
using System.Threading;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Test.JobTests

View File

@ -1,6 +1,7 @@
using System;
using System.Linq;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Instrumentation

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;

View File

@ -1,6 +1,7 @@
using System.Linq;
using System;
using NLog;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Converting;

View File

@ -1,6 +1,7 @@
using System.Linq;
using System;
using NLog;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;

View File

@ -2,6 +2,7 @@
using System;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification;

View File

@ -1,6 +1,7 @@
using System.Linq;
using System;
using NLog;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Converting;

View File

@ -1,6 +1,7 @@
using System.Linq;
using System;
using NLog;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;

View File

@ -2,7 +2,7 @@
using System.Linq;
using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Jobs
namespace NzbDrone.Core.Jobs.Framework
{
public interface IJob
{

View File

@ -6,11 +6,10 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
namespace NzbDrone.Core.Jobs
namespace NzbDrone.Core.Jobs.Framework
{
public interface IJobController
{

View File

@ -2,7 +2,7 @@
using System;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Jobs
namespace NzbDrone.Core.Jobs.Framework
{
public class JobDefinition : ModelBase
{

View File

@ -1,6 +1,7 @@
using System;
using System.Linq;
using System;
namespace NzbDrone.Core.Model
namespace NzbDrone.Core.Jobs.Framework
{
public class JobQueueItem : IEquatable<JobQueueItem>
{

View File

@ -5,7 +5,7 @@ using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Lifecycle;
namespace NzbDrone.Core.Jobs
namespace NzbDrone.Core.Jobs.Framework
{
public interface IJobRepository : IInitializable, IBasicRepository<JobDefinition>
{

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;

View File

@ -3,6 +3,7 @@ using System;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;

View File

@ -3,6 +3,7 @@ using System.Linq;
using System;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;

View File

@ -5,6 +5,7 @@ using NLog;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Download;
using NzbDrone.Core.ExternalNotification;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;

View File

@ -4,6 +4,7 @@ using System;
using NLog;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Download;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;

View File

@ -6,6 +6,7 @@ using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;

View File

@ -4,6 +4,7 @@ using System.Linq;
using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.ReferenceData;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Helpers;

View File

@ -1,5 +1,6 @@
using System;
using System.Linq;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.ReferenceData;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;

View File

@ -3,6 +3,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Lifecycle

View File

@ -3,6 +3,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Lifecycle

View File

@ -5,6 +5,7 @@ using System.IO;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Jobs.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;

View File

@ -14,14 +14,14 @@
/// <summary>
/// Episode has aired, but no episode
/// files are avilable
/// files are available
/// Todo: We shouldn't set missing until the episode has past the actual airtime + runtime, including UtcOffset
/// </summary>
Missing,
/// <summary>
/// Episode airs today, but no episode
/// files are avilable
/// files are available
/// </summary>
AirsToday,

View File

@ -224,7 +224,7 @@
<Compile Include="Instrumentation\LogInjectionModule.cs" />
<Compile Include="Instrumentation\LogRepository.cs" />
<Compile Include="Jobs\CleanupRecycleBinJob.cs" />
<Compile Include="Jobs\JobRepository.cs" />
<Compile Include="Jobs\Framework\JobRepository.cs" />
<Compile Include="Lifecycle\AppShutdownJob.cs" />
<Compile Include="Lifecycle\AppRestartJob.cs" />
<Compile Include="Jobs\XemUpdateJob.cs" />
@ -253,7 +253,7 @@
<Compile Include="Model\Nzbx\NzbxRecentItem.cs" />
<Compile Include="Model\Nzbx\NzbxVotesModel.cs" />
<Compile Include="Model\PostDownloadStatusType.cs" />
<Compile Include="Model\JobQueueItem.cs" />
<Compile Include="Jobs\Framework\JobQueueItem.cs" />
<Compile Include="Model\LanguageType.cs" />
<Compile Include="Model\MisnamedEpisodeModel.cs" />
<Compile Include="Qualities\QualitySizeRepository.cs" />
@ -318,7 +318,7 @@
<Compile Include="Tv\SeasonService.cs" />
<Compile Include="Jobs\RecentBacklogSearchJob.cs" />
<Compile Include="Instrumentation\TrimLogsJob.cs" />
<Compile Include="Jobs\JobController.cs" />
<Compile Include="Jobs\Framework\JobController.cs" />
<Compile Include="Jobs\RenameSeasonJob.cs" />
<Compile Include="Jobs\RenameSeriesJob.cs" />
<Compile Include="Lifecycle\AppUpdateJob.cs" />
@ -335,7 +335,7 @@
<Compile Include="Jobs\DeleteSeriesJob.cs" />
<Compile Include="Jobs\DiskScanJob.cs" />
<Compile Include="Jobs\ImportNewSeriesJob.cs" />
<Compile Include="Jobs\IJob.cs" />
<Compile Include="Jobs\Framework\IJob.cs" />
<Compile Include="Jobs\RssSyncJob.cs" />
<Compile Include="Jobs\UpdateInfoJob.cs" />
<Compile Include="MetadataSource\TvRageMappingProvider.cs" />
@ -525,7 +525,7 @@
</Compile>
<Compile Include="Indexers\NewznabDefinition.cs" />
<Compile Include="ExternalNotification\ExternalNotificationDefinition.cs" />
<Compile Include="Jobs\JobDefinition.cs" />
<Compile Include="Jobs\Framework\JobDefinition.cs" />
<Compile Include="Indexers\Indexer.cs" />
<Compile Include="Model\EpisodeParseResult.cs" />
<Compile Include="Model\EpisodeSortingType.cs" />