You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.9 KiB
65 lines
1.9 KiB
13 years ago
|
using System;
|
||
12 years ago
|
using System.Linq;
|
||
13 years ago
|
using NLog;
|
||
13 years ago
|
using NzbDrone.Common;
|
||
12 years ago
|
using NzbDrone.Core.Configuration;
|
||
14 years ago
|
using NzbDrone.Core.Model.Notification;
|
||
13 years ago
|
using NzbDrone.Core.Providers;
|
||
14 years ago
|
|
||
12 years ago
|
namespace NzbDrone.Core.Jobs.Implementations
|
||
14 years ago
|
{
|
||
14 years ago
|
public class PostDownloadScanJob : IJob
|
||
14 years ago
|
{
|
||
13 years ago
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||
|
|
||
13 years ago
|
private readonly PostDownloadProvider _postDownloadProvider;
|
||
12 years ago
|
private readonly IConfigService _configService;
|
||
13 years ago
|
private readonly DiskProvider _diskProvider;
|
||
14 years ago
|
|
||
12 years ago
|
public PostDownloadScanJob(PostDownloadProvider postDownloadProvider,IConfigService configService, DiskProvider diskProvider)
|
||
14 years ago
|
{
|
||
13 years ago
|
_postDownloadProvider = postDownloadProvider;
|
||
12 years ago
|
_configService = configService;
|
||
13 years ago
|
_diskProvider = diskProvider;
|
||
14 years ago
|
}
|
||
|
|
||
14 years ago
|
public PostDownloadScanJob()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public string Name
|
||
|
{
|
||
14 years ago
|
get { return "Drop folder monitor"; }
|
||
14 years ago
|
}
|
||
|
|
||
13 years ago
|
public TimeSpan DefaultInterval
|
||
14 years ago
|
{
|
||
13 years ago
|
get { return TimeSpan.FromMinutes(1); }
|
||
14 years ago
|
}
|
||
14 years ago
|
|
||
12 years ago
|
public virtual void Start(ProgressNotification notification, dynamic options)
|
||
14 years ago
|
{
|
||
12 years ago
|
string dropFolder;
|
||
|
|
||
|
if (options != null && !String.IsNullOrWhiteSpace(options.Path))
|
||
|
dropFolder = options.Path;
|
||
|
|
||
|
else
|
||
12 years ago
|
dropFolder = _configService.DownloadClientTvDirectory;
|
||
13 years ago
|
|
||
|
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);
|
||
14 years ago
|
}
|
||
|
}
|
||
13 years ago
|
}
|