mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-07 09:04:15 +00:00
split torrent_status for future async
This commit is contained in:
parent
3807b372ff
commit
83cc479898
@ -145,14 +145,11 @@ def get_stats():
|
|||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
def enhance_torrent_status(torrent_id,status):
|
||||||
def get_torrent_status(torrent_id):
|
|
||||||
"""
|
"""
|
||||||
helper method.
|
in: raw torrent_status
|
||||||
enhance ws.proxy.get_torrent_status with some extra data
|
out: enhanced torrent_staus
|
||||||
"""
|
"""
|
||||||
status = Storage(ws.proxy.get_torrent_status(torrent_id,TORRENT_KEYS))
|
|
||||||
|
|
||||||
#add missing values for deluge 0.6:
|
#add missing values for deluge 0.6:
|
||||||
for key in TORRENT_KEYS:
|
for key in TORRENT_KEYS:
|
||||||
if not key in status:
|
if not key in status:
|
||||||
@ -209,7 +206,7 @@ def get_torrent_status(torrent_id):
|
|||||||
})
|
})
|
||||||
|
|
||||||
#no non-unicode string may enter the templates.
|
#no non-unicode string may enter the templates.
|
||||||
#FIXED,l was a translation bug..
|
#FIXED, was a translation bug..
|
||||||
if debug_unicode:
|
if debug_unicode:
|
||||||
for k, v in status.iteritems():
|
for k, v in status.iteritems():
|
||||||
if (not isinstance(v, unicode)) and isinstance(v, str):
|
if (not isinstance(v, unicode)) and isinstance(v, str):
|
||||||
@ -219,6 +216,16 @@ def get_torrent_status(torrent_id):
|
|||||||
raise Exception('Non Unicode for key:%s' % (k, ))
|
raise Exception('Non Unicode for key:%s' % (k, ))
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
def get_torrent_status(torrent_id):
|
||||||
|
"""
|
||||||
|
helper method.
|
||||||
|
enhance ws.proxy.get_torrent_status with some extra data
|
||||||
|
"""
|
||||||
|
status = Storage(ws.proxy.get_torrent_status(torrent_id,TORRENT_KEYS))
|
||||||
|
|
||||||
|
return enhance_torrent_status(torrent_id, status)
|
||||||
|
|
||||||
|
|
||||||
def get_categories(torrent_list):
|
def get_categories(torrent_list):
|
||||||
trackers = [(torrent['category'] or 'unknown') for torrent in torrent_list]
|
trackers = [(torrent['category'] or 'unknown') for torrent in torrent_list]
|
||||||
categories = {}
|
categories = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user