1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Added warning to Sabnzbd Client Test to disable the sabnzbd pre-check option.

This commit is contained in:
Taloth Saldono 2014-08-03 00:51:20 +02:00 committed by Mark McDowall
parent 6c44121b09
commit 10de8087f7
3 changed files with 24 additions and 7 deletions

View File

@ -355,6 +355,7 @@ protected override void Test(List<ValidationFailure> failures)
{ {
failures.AddIfNotNull(TestConnection()); failures.AddIfNotNull(TestConnection());
failures.AddIfNotNull(TestAuthentication()); failures.AddIfNotNull(TestAuthentication());
failures.AddIfNotNull(TestGlobalConfig());
failures.AddIfNotNull(TestCategory()); failures.AddIfNotNull(TestCategory());
if (!Settings.TvCategoryLocalPath.IsNullOrWhiteSpace()) if (!Settings.TvCategoryLocalPath.IsNullOrWhiteSpace())
@ -400,9 +401,24 @@ private ValidationFailure TestAuthentication()
return null; return null;
} }
private ValidationFailure TestGlobalConfig()
{
var config = _proxy.GetConfig(Settings);
if (config.Misc.pre_check)
{
return new NzbDroneValidationFailure("", "Disable 'Check before download' option in Sabnbzd")
{
InfoLink = String.Format("http://{0}:{1}/sabnzbd/config/switches/", Settings.Host, Settings.Port),
DetailedDescription = "Using Check before download affects NzbDrone ability to track new downloads. Also Sabnzbd recommends 'Abort jobs that cannot be completed' instead since it's more effective."
};
}
return null;
}
private ValidationFailure TestCategory() private ValidationFailure TestCategory()
{ {
var config = this._proxy.GetConfig(Settings); var config = _proxy.GetConfig(Settings);
var category = GetCategories(config).FirstOrDefault((SabnzbdCategory v) => v.Name == Settings.TvCategory); var category = GetCategories(config).FirstOrDefault((SabnzbdCategory v) => v.Name == Settings.TvCategory);
if (category != null) if (category != null)

View File

@ -19,6 +19,7 @@ public class SabnzbdConfigMisc
public String complete_dir { get; set; } public String complete_dir { get; set; }
public String[] tv_categories { get; set; } public String[] tv_categories { get; set; }
public Boolean enable_tv_sorting { get; set; } public Boolean enable_tv_sorting { get; set; }
public Boolean pre_check { get; set; }
} }
public class SabnzbdCategory public class SabnzbdCategory

View File

@ -147,7 +147,7 @@ private Boolean UpdateTrackedDownloads()
State = TrackedDownloadState.Unknown State = TrackedDownloadState.Unknown
}; };
_logger.Debug("Started tracking download from history: {0}: {1}", trackedDownload.TrackingId, downloadItem.Title); _logger.Debug("[{0}] Started tracking download with id {1}.", downloadItem.Title, trackingId);
stateChanged = true; stateChanged = true;
} }
@ -157,17 +157,17 @@ private Boolean UpdateTrackedDownloads()
} }
} }
foreach (var downloadItem in oldTrackedDownloads.Values.Where(v => !newTrackedDownloads.ContainsKey(v.TrackingId))) foreach (var trackedDownload in oldTrackedDownloads.Values.Where(v => !newTrackedDownloads.ContainsKey(v.TrackingId)))
{ {
if (downloadItem.State != TrackedDownloadState.Removed) if (trackedDownload.State != TrackedDownloadState.Removed)
{ {
downloadItem.State = TrackedDownloadState.Removed; trackedDownload.State = TrackedDownloadState.Removed;
stateChanged = true; stateChanged = true;
_logger.Debug("Item removed from download client by user: {0}: {1}", downloadItem.TrackingId, downloadItem.DownloadItem.Title); _logger.Debug("[{0}] Item with id {1} removed from download client directly (possibly by user).", trackedDownload.DownloadItem.Title, trackedDownload.TrackingId);
} }
_logger.Debug("Stopped tracking download: {0}: {1}", downloadItem.TrackingId, downloadItem.DownloadItem.Title); _logger.Debug("[{0}] Stopped tracking download with id {1}.", trackedDownload.DownloadItem.Title, trackedDownload.TrackingId);
} }
_trackedDownloadCache.Set("tracked", newTrackedDownloads.Values.ToArray()); _trackedDownloadCache.Set("tracked", newTrackedDownloads.Values.ToArray());