mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Prevent invalid response to get torrents from Deluge from throwing an error
This commit is contained in:
parent
a5b09b8975
commit
d651e6ac52
@ -66,7 +66,7 @@ public DelugeTorrent[] GetTorrents(DelugeSettings settings)
|
||||
//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);
|
||||
|
||||
return response.Result.Torrents.Values.ToArray();
|
||||
return GetTorrents(response.Result);
|
||||
}
|
||||
|
||||
public DelugeTorrent[] GetTorrentsByLabel(String label, DelugeSettings settings)
|
||||
@ -74,11 +74,10 @@ public DelugeTorrent[] GetTorrentsByLabel(String label, DelugeSettings settings)
|
||||
var filter = new Dictionary<String, Object>();
|
||||
filter.Add("label", label);
|
||||
|
||||
|
||||
//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);
|
||||
|
||||
return response.Result.Torrents.Values.ToArray();
|
||||
return GetTorrents(response.Result);
|
||||
}
|
||||
|
||||
public String AddTorrentFromMagnet(String magnetLink, DelugeSettings settings)
|
||||
@ -301,5 +300,15 @@ private Int32 GetCallId()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user