Fix #2277 : Plugins keys weren't fetched in filter_torrent_ids
Fixed bug introduced in 8c106ce8c4
where keys for plugins weren't fetched in filter_torrent_ids.
This commit is contained in:
parent
4b31061037
commit
e6498b6864
|
@ -420,9 +420,9 @@ class Core(component.Component):
|
|||
for torrent_id in torrent_ids:
|
||||
self.torrentmanager[torrent_id].resume()
|
||||
|
||||
def create_torrent_status(self, torrent_id, torrent_keys, plugin_keys, diff=False, update=False):
|
||||
def create_torrent_status(self, torrent_id, torrent_keys, plugin_keys, diff=False, update=False, all_keys=False):
|
||||
try:
|
||||
status = self.torrentmanager[torrent_id].get_status(torrent_keys, diff, update=update)
|
||||
status = self.torrentmanager[torrent_id].get_status(torrent_keys, diff, update=update, all_keys=all_keys)
|
||||
except KeyError:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
@ -437,7 +437,7 @@ class Core(component.Component):
|
|||
@export
|
||||
def get_torrent_status(self, torrent_id, keys, diff=False):
|
||||
torrent_keys, plugin_keys = self.torrentmanager.separate_keys(keys, [torrent_id])
|
||||
return self.create_torrent_status(torrent_id, torrent_keys, plugin_keys, diff=diff, update=True)
|
||||
return self.create_torrent_status(torrent_id, torrent_keys, plugin_keys, diff=diff, update=True, all_keys=not keys)
|
||||
|
||||
@export
|
||||
def get_torrents_status(self, filter_dict, keys, diff=False):
|
||||
|
|
|
@ -189,10 +189,11 @@ class FilterManager(component.Component):
|
|||
if not filter_dict: #return if there's nothing more to filter
|
||||
return torrent_ids
|
||||
|
||||
torrent_keys, plugin_keys = self.torrents.separate_keys(filter_dict.keys(), torrent_ids)
|
||||
#leftover filter arguments:
|
||||
#default filter on status fields.
|
||||
for torrent_id in list(torrent_ids):
|
||||
status = self.torrents[torrent_id].get_status(filter_dict.keys()) #status={key:value}
|
||||
status = self.core.create_torrent_status(torrent_id, torrent_keys, plugin_keys)
|
||||
for field, values in filter_dict.iteritems():
|
||||
if (not status[field] in values) and torrent_id in torrent_ids:
|
||||
torrent_ids.remove(torrent_id)
|
||||
|
|
|
@ -626,7 +626,7 @@ class Torrent(object):
|
|||
return host
|
||||
return ""
|
||||
|
||||
def get_status(self, keys, diff=False, update=False):
|
||||
def get_status(self, keys, diff=False, update=False, all_keys=False):
|
||||
"""
|
||||
Returns the status of the torrent based on the keys provided
|
||||
|
||||
|
@ -646,7 +646,7 @@ class Torrent(object):
|
|||
if update:
|
||||
self.update_status(self.handle.status())
|
||||
|
||||
if not keys:
|
||||
if all_keys:
|
||||
keys = self.status_funcs.keys()
|
||||
|
||||
status_dict = {}
|
||||
|
|
|
@ -1151,7 +1151,7 @@ class TorrentManager(component.Component):
|
|||
# Could be the clients cache (sessionproxy) isn't up to speed.
|
||||
del status_dict[torrent_id]
|
||||
else:
|
||||
status_dict[torrent_id] = self.torrents[torrent_id].get_status(torrent_keys, diff)
|
||||
status_dict[torrent_id] = self.torrents[torrent_id].get_status(torrent_keys, diff, all_keys=not keys)
|
||||
self.status_dict = status_dict
|
||||
d.callback((status_dict, plugin_keys))
|
||||
|
||||
|
|
Loading…
Reference in New Issue