Sean Seymour 1 month ago committed by GitHub
commit 5e3a3a0753
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -121,6 +121,13 @@ namespace NzbDrone.Core.Download.Clients.Deluge
torrents = _proxy.GetTorrents(Settings);
}
var useFailureCategory = Settings.MusicFailureCategory.IsNotNullOrWhiteSpace();
if (useFailureCategory)
{
torrents = torrents.Concat(_proxy.GetTorrentsByLabel(Settings.MusicFailureCategory, Settings));
}
var items = new List<DownloadClientItem>();
foreach (var torrent in torrents)
@ -154,7 +161,11 @@ namespace NzbDrone.Core.Download.Clients.Deluge
item.TotalSize = torrent.Size;
if (torrent.State == DelugeTorrentStatus.Error)
if (useFailureCategory && torrent.Label == Settings.MusicFailureCategory)
{
item.Status = DownloadItemStatus.Failed;
}
else if (torrent.State == DelugeTorrentStatus.Error)
{
item.Status = DownloadItemStatus.Warning;
item.Message = "Deluge is reporting an error";
@ -280,9 +291,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge
_logger.Error(ex, "Failed to test connection");
return new NzbDroneValidationFailure("Host", "Unable to connect to Deluge")
{
DetailedDescription = ex.Message
};
{
DetailedDescription = ex.Message
};
}
return null;
@ -335,6 +346,20 @@ namespace NzbDrone.Core.Download.Clients.Deluge
}
}
if (Settings.MusicFailureCategory.IsNotNullOrWhiteSpace() && !labels.Contains(Settings.MusicFailureCategory))
{
_proxy.AddLabel(Settings.MusicFailureCategory, Settings);
labels = _proxy.GetAvailableLabels(Settings);
if (!labels.Contains(Settings.MusicFailureCategory))
{
return new NzbDroneValidationFailure("MusicFailureCategory", "Configuration of label failed")
{
DetailedDescription = "Lidarr was unable to add the label to Deluge."
};
}
}
return null;
}

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public class DelugeProxy : IDelugeProxy
{
private static readonly string[] RequiredProperties = new string[] { "hash", "name", "state", "progress", "eta", "message", "is_finished", "save_path", "total_size", "total_done", "time_added", "active_time", "ratio", "is_auto_managed", "stop_at_ratio", "remove_at_ratio", "stop_ratio" };
private static readonly string[] RequiredProperties = new string[] { "hash", "name", "state", "progress", "eta", "message", "is_finished", "save_path", "total_size", "total_done", "time_added", "active_time", "ratio", "is_auto_managed", "stop_at_ratio", "remove_at_ratio", "stop_ratio", "label" };
private readonly IHttpClient _httpClient;
private readonly Logger _logger;

@ -50,6 +50,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge
[FieldDefinition(6, Label = "Post-Import Category", Type = FieldType.Textbox, Advanced = true, HelpText = "Category for Lidarr to set after it has imported the download. Lidarr will not remove torrents in that category even if seeding finished. Leave blank to keep same category.")]
public string MusicImportedCategory { get; set; }
[FieldDefinition(6, Label = "Failure Category", Type = FieldType.Textbox, Advanced = true, HelpText = "Category for Lidarr to treat a download as failed (applied externally). Leave blank to ignore.")]
public string MusicFailureCategory { get; set; }
[FieldDefinition(7, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing albums released within the last 14 days")]
public int RecentMusicPriority { get; set; }

@ -51,5 +51,8 @@ namespace NzbDrone.Core.Download.Clients.Deluge
[JsonProperty(PropertyName = "stop_ratio")]
public double StopRatio { get; set; }
[JsonProperty(PropertyName = "label")]
public string Label { get; set; }
}
}

Loading…
Cancel
Save