From d8746a88526bb059d45b89ce1daeb7cf4c58d0b9 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Fri, 21 Jan 2022 22:06:32 -0500 Subject: [PATCH] [Core] Return plugin keys with get_torrents_status When requesting all keys, get_torrents_status was missing plugin added keys This commit brings the behavior in line with get_torrent_status, and deluge 1.3 Closes: https://dev.deluge-torrent.org/ticket/3357 Closes: https://github.com/deluge-torrent/deluge/pull/347 --- deluge/core/core.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 0563318a5..a763b8d2f 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -763,25 +763,21 @@ class Core(component.Component): ) @export + @defer.inlineCallbacks def get_torrents_status(self, filter_dict, keys, diff=False): """ returns all torrents , optionally filtered by filter_dict. """ + all_keys = not keys torrent_ids = self.filtermanager.filter_torrent_ids(filter_dict) - d = self.torrentmanager.torrents_status_update(torrent_ids, keys, diff=diff) - - def add_plugin_fields(args): - status_dict, plugin_keys = args - # Ask the plugin manager to fill in the plugin keys - if len(plugin_keys) > 0: - for key in status_dict: - status_dict[key].update( - self.pluginmanager.get_status(key, plugin_keys) - ) - return status_dict - - d.addCallback(add_plugin_fields) - return d + status_dict, plugin_keys = yield self.torrentmanager.torrents_status_update( + torrent_ids, keys, diff=diff + ) + # Ask the plugin manager to fill in the plugin keys + if len(plugin_keys) > 0 or all_keys: + for key in status_dict: + status_dict[key].update(self.pluginmanager.get_status(key, plugin_keys)) + return status_dict @export def get_filter_tree(self, show_zero_hits=True, hide_cat=None):