mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
moved jobs around again ;)
This commit is contained in:
parent
50674d388c
commit
568d4b8eeb
29 changed files with 70 additions and 121 deletions
65
NzbDrone.Core/Jobs/Implementations/PostDownloadScanJob.cs
Normal file
65
NzbDrone.Core/Jobs/Implementations/PostDownloadScanJob.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
namespace NzbDrone.Core.Jobs.Implementations
|
||||
{
|
||||
public class PostDownloadScanJob : IJob
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly PostDownloadProvider _postDownloadProvider;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
|
||||
public PostDownloadScanJob(PostDownloadProvider postDownloadProvider,IConfigService configService, DiskProvider diskProvider)
|
||||
{
|
||||
_postDownloadProvider = postDownloadProvider;
|
||||
_configService = configService;
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
public PostDownloadScanJob()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Drop folder monitor"; }
|
||||
}
|
||||
|
||||
public TimeSpan DefaultInterval
|
||||
{
|
||||
get { return TimeSpan.FromMinutes(1); }
|
||||
}
|
||||
|
||||
public virtual void Start(ProgressNotification notification, dynamic options)
|
||||
{
|
||||
string dropFolder;
|
||||
|
||||
if (options != null && !String.IsNullOrWhiteSpace(options.Path))
|
||||
dropFolder = options.Path;
|
||||
|
||||
else
|
||||
dropFolder = _configService.DownloadClientTvDirectory;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(dropFolder))
|
||||
{
|
||||
Logger.Debug("No drop folder is defined. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_diskProvider.FolderExists(dropFolder))
|
||||
{
|
||||
Logger.Warn("Unable to Scan for New Downloads - folder Doesn't exist: [{0}]", dropFolder);
|
||||
return;
|
||||
}
|
||||
|
||||
_postDownloadProvider.ProcessDropFolder(dropFolder);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue