1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-28 08:58:41 +02:00

New: Bypass archived history for failed downloads in SABnzbd

This commit is contained in:
Mark McDowall 2024-02-26 20:56:59 -08:00 committed by Mark McDowall
parent 9fd193d2a8
commit c99d81e79b
2 changed files with 17 additions and 5 deletions

View File

@ -205,11 +205,11 @@ public override void RemoveItem(DownloadClientItem item, bool deleteData)
DeleteItemData(item);
}
_proxy.RemoveFrom("history", item.DownloadId, deleteData, Settings);
_proxy.RemoveFromHistory(item.DownloadId, deleteData, item.Status == DownloadItemStatus.Failed, Settings);
}
else
{
_proxy.RemoveFrom("queue", item.DownloadId, deleteData, Settings);
_proxy.RemoveFromQueue(item.DownloadId, deleteData, Settings);
}
}

View File

@ -14,7 +14,8 @@ public interface ISabnzbdProxy
{
string GetBaseUrl(SabnzbdSettings settings, string relativePath = null);
SabnzbdAddResponse DownloadNzb(byte[] nzbData, string filename, string category, int priority, SabnzbdSettings settings);
void RemoveFrom(string source, string id, bool deleteData, SabnzbdSettings settings);
void RemoveFromQueue(string id, bool deleteData, SabnzbdSettings settings);
void RemoveFromHistory(string id, bool deleteData, bool deletePermanently, SabnzbdSettings settings);
string GetVersion(SabnzbdSettings settings);
SabnzbdConfig GetConfig(SabnzbdSettings settings);
SabnzbdFullStatus GetFullStatus(SabnzbdSettings settings);
@ -60,9 +61,9 @@ public SabnzbdAddResponse DownloadNzb(byte[] nzbData, string filename, string ca
return response;
}
public void RemoveFrom(string source, string id, bool deleteData, SabnzbdSettings settings)
public void RemoveFromQueue(string id, bool deleteData, SabnzbdSettings settings)
{
var request = BuildRequest(source, settings);
var request = BuildRequest("queue", settings);
request.AddQueryParam("name", "delete");
request.AddQueryParam("del_files", deleteData ? 1 : 0);
request.AddQueryParam("value", id);
@ -70,6 +71,17 @@ public void RemoveFrom(string source, string id, bool deleteData, SabnzbdSetting
ProcessRequest(request, settings);
}
public void RemoveFromHistory(string id, bool deleteData, bool deletePermanently, SabnzbdSettings settings)
{
var request = BuildRequest("history", settings);
request.AddQueryParam("name", "delete");
request.AddQueryParam("del_files", deleteData ? 1 : 0);
request.AddQueryParam("value", id);
request.AddQueryParam("archive", deletePermanently ? 0 : 1);
ProcessRequest(request, settings);
}
public string GetVersion(SabnzbdSettings settings)
{
var request = BuildRequest("version", settings);