mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed: Changed the api call for Deluge to reduce the response size preventing a timeout when a lot of torrents are listed.
This commit is contained in:
parent
1cb0bb56cd
commit
764ce3507c
@ -31,6 +31,8 @@ public interface IDelugeProxy
|
||||
|
||||
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 readonly Logger _logger;
|
||||
|
||||
private string _authPassword;
|
||||
@ -61,9 +63,11 @@ public DelugeTorrent[] GetTorrents(DelugeSettings settings)
|
||||
{
|
||||
var filter = new Dictionary<String, Object>();
|
||||
|
||||
var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
|
||||
// TODO: get_torrents_status returns the files as well, which starts to cause deluge timeouts when you get enough season packs.
|
||||
//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.Values.ToArray();
|
||||
return response.Result.Torrents.Values.ToArray();
|
||||
}
|
||||
|
||||
public DelugeTorrent[] GetTorrentsByLabel(String label, DelugeSettings settings)
|
||||
@ -71,9 +75,11 @@ 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]);
|
||||
|
||||
return response.Result.Values.ToArray();
|
||||
//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();
|
||||
}
|
||||
|
||||
public String AddTorrentFromMagnet(String magnetLink, DelugeSettings settings)
|
||||
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.Deluge
|
||||
{
|
||||
public class DelugeUpdateUIResult
|
||||
{
|
||||
public Dictionary<String, Object> Stats { get; set; }
|
||||
public Boolean Connected { get; set; }
|
||||
public Dictionary<String, DelugeTorrent> Torrents { get; set; }
|
||||
}
|
||||
}
|
@ -287,6 +287,7 @@
|
||||
<Compile Include="Download\Clients\Deluge\DelugeTorrent.cs" />
|
||||
<Compile Include="Download\Clients\Deluge\DelugeTorrentStatus.cs" />
|
||||
<Compile Include="Download\Clients\Deluge\DelugePriority.cs" />
|
||||
<Compile Include="Download\Clients\Deluge\DelugeUpdateUIResult.cs" />
|
||||
<Compile Include="Download\Clients\DownloadClientAuthenticationException.cs" />
|
||||
<Compile Include="Download\Clients\DownloadClientException.cs" />
|
||||
<Compile Include="Download\Clients\Nzbget\ErrorModel.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user