torrent_info:display torrent files

This commit is contained in:
Martijn Voncken 2008-02-12 21:03:33 +00:00
parent 75663de03c
commit 991a413327
6 changed files with 27 additions and 6 deletions

View File

@ -89,6 +89,15 @@ def template_crop(text, end):
return "[ERROR NOT A STRING:(%s)]" % text
return text
def template_crop_right(text, maxlen):
try:
if len(text) > maxlen:
return "..." + text[-(maxlen + 3):]
except:
return "[ERROR NOT A STRING:(%s)]" % text
return text
def template_sort_head(id,name):
#got tired of doing these complex things inside templetor..
vars = web.input(sort = None, order = None)
@ -136,6 +145,7 @@ template.Template.globals.update({
'part_stats':template_part_stats,
'category_tabs':category_tabs,
'crop': template_crop,
'crop_right': template_crop_right,
'_': _ , #gettext/translations
'str': str, #because % in templetor is broken.
'int':int,

View File

@ -86,6 +86,14 @@ tr.altrow1{
background-color: #37506f;
}
tr.tab_altrow0{
background-color: #304663;
}
tr.tab_altrow1{
background-color: #37506f;
}
tr.torrent_table_selected {

View File

@ -2,8 +2,8 @@ $def with (torrent)
$:(render.header(torrent.message + '/' + torrent.name))
<div class="panel">
<h3>$_('Details')</h3>
<h3>$_('Details')</h3>
$:render.tab_meta(torrent)
$if (torrent.action == 'start'):
@ -18,6 +18,9 @@ $:render.part_button('POST', '/torrent/reannounce/' + str(torrent.id), _('Reanno
$:render.part_button('POST', '/torrent/queue/up/' + str(torrent.id), _('Queue Up'), 'tango/queue-up.png')
$:render.part_button('POST', '/torrent/queue/down/' + str(torrent.id), _('Queue Down'), 'tango/queue-down.png')
<br>
$:render.tab_files(torrent)
<br>
<!--
[<a onclick="javascript:toggle_dump()">$_('Debug:Data Dump')</a>]

View File

@ -68,12 +68,12 @@ start = time.time()
torrent_ids = ws.proxy.get_session_state() #Syc-api.
torrent_dict = {}
for id in torrent_ids:
async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, ["name"])
async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, [])
async_proxy.force_call(block=True)
print "Async-list:",time.time() - start
print torrent_dict[torrent_ids[0]].keys()
print torrent_dict[torrent_ids[0]]["name"]
print "\n".join(torrent_dict[torrent_ids[0]].keys())
print torrent_dict[torrent_ids[0]]["files"]

View File

@ -224,7 +224,7 @@ def get_torrent_status(torrent_id):
helper method.
enhance ws.proxy.get_torrent_status with some extra data
"""
status = ws.proxy.get_torrent_status(torrent_id,[])
status = ws.proxy.get_torrent_status(torrent_id,TORRENT_KEYS)
return enhance_torrent_status(torrent_id, status)

View File

@ -71,7 +71,7 @@ TORRENT_KEYS = ['distributed_copies', 'download_payload_rate',
'total_payload_download', 'total_payload_upload', 'total_peers',
'total_seeds', 'total_size', 'total_upload', 'total_wanted',
'tracker_status', 'upload_payload_rate',
'uploaded_memory','tracker','state','queue_pos','user_paused']
'uploaded_memory','tracker','state','queue_pos','user_paused','files']
STATE_MESSAGES = (_("Queued"),
_("Checking"),