mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
Prevent invalid response to get torrents from Deluge from throwing an error
This commit is contained in:
@@ -66,7 +66,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
|||||||
//var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
|
//var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
|
||||||
var response = ProcessRequest<DelugeUpdateUIResult>(settings, "web.update_ui", requiredProperties, filter);
|
var response = ProcessRequest<DelugeUpdateUIResult>(settings, "web.update_ui", requiredProperties, filter);
|
||||||
|
|
||||||
return response.Result.Torrents.Values.ToArray();
|
return GetTorrents(response.Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelugeTorrent[] GetTorrentsByLabel(String label, DelugeSettings settings)
|
public DelugeTorrent[] GetTorrentsByLabel(String label, DelugeSettings settings)
|
||||||
@@ -74,11 +74,10 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
|||||||
var filter = new Dictionary<String, Object>();
|
var filter = new Dictionary<String, Object>();
|
||||||
filter.Add("label", label);
|
filter.Add("label", label);
|
||||||
|
|
||||||
|
|
||||||
//var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
|
//var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
|
||||||
var response = ProcessRequest<DelugeUpdateUIResult>(settings, "web.update_ui", requiredProperties, filter);
|
var response = ProcessRequest<DelugeUpdateUIResult>(settings, "web.update_ui", requiredProperties, filter);
|
||||||
|
|
||||||
return response.Result.Torrents.Values.ToArray();
|
return GetTorrents(response.Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String AddTorrentFromMagnet(String magnetLink, DelugeSettings settings)
|
public String AddTorrentFromMagnet(String magnetLink, DelugeSettings settings)
|
||||||
@@ -301,5 +300,15 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
|||||||
{
|
{
|
||||||
return System.Threading.Interlocked.Increment(ref _callId);
|
return System.Threading.Interlocked.Increment(ref _callId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DelugeTorrent[] GetTorrents(DelugeUpdateUIResult result)
|
||||||
|
{
|
||||||
|
if (result.Torrents == null)
|
||||||
|
{
|
||||||
|
return new DelugeTorrent[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.Torrents.Values.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user