mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 23:53:23 +00:00
Minor code cleanup.
This commit is contained in:
parent
81ca9952e9
commit
6a8e3f1c49
@ -75,11 +75,11 @@ class SessionProxy(component.Component):
|
|||||||
def on_torrent_status(status):
|
def on_torrent_status(status):
|
||||||
# Save the time we got the torrent status
|
# Save the time we got the torrent status
|
||||||
t = time.time()
|
t = time.time()
|
||||||
for key, value in status.items():
|
for key, value in status.iteritems():
|
||||||
self.torrents[key] = [t, value]
|
self.torrents[key] = [t, value]
|
||||||
self.cache_times[key] = {}
|
self.cache_times[key] = {}
|
||||||
for k, v in value.items():
|
for ikey in value.iterkeys():
|
||||||
self.cache_times[key][k] = t
|
self.cache_times[key][ikey] = t
|
||||||
|
|
||||||
return client.core.get_torrents_status({}, [], True).addCallback(on_torrent_status)
|
return client.core.get_torrents_status({}, [], True).addCallback(on_torrent_status)
|
||||||
|
|
||||||
@ -105,7 +105,10 @@ class SessionProxy(component.Component):
|
|||||||
sd = {}
|
sd = {}
|
||||||
for torrent_id in torrent_ids:
|
for torrent_id in torrent_ids:
|
||||||
if keys:
|
if keys:
|
||||||
sd[torrent_id] = dict([(x, y) for x, y in self.torrents[torrent_id][1].iteritems() if x in keys])
|
sd[torrent_id] = dict([
|
||||||
|
(x, y) for x, y in self.torrents[torrent_id][1].iteritems()
|
||||||
|
if x in keys
|
||||||
|
])
|
||||||
else:
|
else:
|
||||||
sd[torrent_id] = dict(self.torrents[torrent_id][1])
|
sd[torrent_id] = dict(self.torrents[torrent_id][1])
|
||||||
|
|
||||||
@ -135,7 +138,9 @@ class SessionProxy(component.Component):
|
|||||||
keys_to_get.append(key)
|
keys_to_get.append(key)
|
||||||
|
|
||||||
if not keys_to_get:
|
if not keys_to_get:
|
||||||
return succeed(self.create_status_dict([torrent_id], keys)[torrent_id])
|
return succeed(
|
||||||
|
self.create_status_dict([torrent_id], keys)[torrent_id]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
d = client.core.get_torrent_status(torrent_id, keys_to_get, True)
|
d = client.core.get_torrent_status(torrent_id, keys_to_get, True)
|
||||||
def on_status(result, torrent_id):
|
def on_status(result, torrent_id):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user