remove 0.5 torrent_info hacks
This commit is contained in:
parent
b3f9785b20
commit
2af622b850
|
@ -129,7 +129,10 @@ def template_sort_head(id,name):
|
|||
return render.sort_column_head(id, name, order, active_up, active_down)
|
||||
|
||||
def template_part_stats():
|
||||
return render.part_stats(get_stats())
|
||||
try:
|
||||
return render.part_stats(get_stats())
|
||||
except Exception:
|
||||
return '[not connected]'
|
||||
|
||||
def get_config(var):
|
||||
return ws.config.get(var)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
$def with (stats)
|
||||
|
||||
|
||||
<div class="panel" id='stats_panel'>
|
||||
<div id='stats_panel'>
|
||||
<!--<a href='/config'>-->
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ $for t in torrent_list:
|
|||
<table class="torrent_list" id="torrent_table" border=0 cellspacing=0 cellpadding=2 id="torrent_list" >
|
||||
<thead class="fixedHeader">
|
||||
<tr>
|
||||
$:(sort_head('calc_state_str', 'S'))
|
||||
$:(sort_head('state', 'S'))
|
||||
$:(sort_head('queue', '#'))
|
||||
$:(sort_head('name', _('Name')))
|
||||
$:(sort_head('total_size', _('Size')))
|
||||
|
@ -26,8 +26,8 @@ $for t in torrent_list:
|
|||
|
||||
$:(sort_head('num_seeds', _('Seeders')))
|
||||
$:(sort_head('num_peers', _('Peers')))
|
||||
$:(sort_head('download_rate', _('Download')))
|
||||
$:(sort_head('upload_rate', _('Upload')))
|
||||
$:(sort_head('download_payload_rate', _('Download')))
|
||||
$:(sort_head('upload_payload_rate', _('Upload')))
|
||||
$:(sort_head('eta', _('Eta')))
|
||||
$:(sort_head('distributed_copies', _('Ava')))
|
||||
$:(sort_head('ratio', _('Ratio')))
|
||||
|
@ -42,7 +42,7 @@ $for torrent in torrent_list:
|
|||
<form action="/torrent/$torrent.action/$torrent.id" method="POST"
|
||||
class="pause_resume">
|
||||
<input type="image"
|
||||
src="/pixmaps/$(torrent.calc_state_str)16.png"
|
||||
src="/pixmaps/$torrent.state.lower()"
|
||||
name="pauseresume" value="submit" />
|
||||
</form>
|
||||
</td>
|
||||
|
@ -53,7 +53,7 @@ $for torrent in torrent_list:
|
|||
<td class="progress_bar">
|
||||
<div class="progress_bar_outer">
|
||||
<div class="progress_bar" style="width:$(torrent.progress)%;overflow:hidden">
|
||||
$torrent.message $int(torrent.progress) %
|
||||
$_(torrent.state) $int(torrent.progress) %
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -71,14 +71,14 @@ $for torrent in torrent_list:
|
|||
$else:
|
||||
0
|
||||
<td>
|
||||
$if (torrent.download_rate):
|
||||
$fspeed(torrent.download_rate)
|
||||
$if (torrent.download_payload_rate):
|
||||
$fspeed(torrent.download_payload_rate)
|
||||
$else:
|
||||
|
||||
</td>
|
||||
<td>
|
||||
$if (torrent.upload_rate):
|
||||
$fspeed(torrent.upload_rate)
|
||||
$if (torrent.upload_payload_rate):
|
||||
$fspeed(torrent.upload_payload_rate)
|
||||
$else:
|
||||
|
||||
</td>
|
||||
|
|
|
@ -7,7 +7,7 @@ $if organize_filters:
|
|||
|
||||
<table class="torrent_list" border=0 id='torrent_table'>
|
||||
<tr>
|
||||
$:(sort_head('calc_state_str', 'S'))
|
||||
$:(sort_head('state', 'S'))
|
||||
$:(sort_head('queue', '#'))
|
||||
$:(sort_head('name', _('Name')))
|
||||
$:(sort_head('total_size', _('Size')))
|
||||
|
@ -26,7 +26,7 @@ $for torrent in torrent_list:
|
|||
<td>
|
||||
<form action="/torrent/$torrent.action/$torrent.id" method="POST" class="pause_resume">
|
||||
<input type="image"
|
||||
src="/pixmaps/$(torrent.calc_state_str)16.png"
|
||||
src="/pixmaps/$torrent.state.lower()"
|
||||
name="pauseresume" value="submit" /></form></td>
|
||||
<td>$torrent.queue</td>
|
||||
<td style="width:100px; overflow:hidden;white-space: nowrap">
|
||||
|
@ -36,14 +36,14 @@ $for torrent in torrent_list:
|
|||
<td class="progress_bar">
|
||||
<div class="progress_bar_outer">
|
||||
<div class="progress_bar" style="width:$(torrent.progress)%">
|
||||
$torrent.message $int(torrent.progress) %
|
||||
$_(torrent.state) $int(torrent.progress) %
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>$torrent.num_seeds ($torrent.total_seeds)</td>
|
||||
<td>$torrent.num_peers ($torrent.total_peers)</td>
|
||||
<td>$fspeed(torrent.download_rate)</td>
|
||||
<td>$fspeed(torrent.upload_rate)</td>
|
||||
<td>$fspeed(torrent.download_payload_rate)</td>
|
||||
<td>$fspeed(torrent.upload_payload_rate)</td>
|
||||
<td>$ftime(torrent.eta)</td>
|
||||
<td>$("%.3f" % torrent.distributed_copies)</td>
|
||||
<td>$("%.3f" % torrent.ratio)</td\>
|
||||
|
|
|
@ -11,10 +11,10 @@ $def with (torrent)
|
|||
<table>
|
||||
|
||||
<tr><td class="info_label">$_('Downloaded'):</td>
|
||||
<td class="info_value">$torrent.calc_total_downloaded</td></tr>
|
||||
<td class="info_value">$fsize(torrent.total_done)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Uploaded'):</td>
|
||||
<td class="info_value">$torrent.calc_total_uploaded</td>
|
||||
<td class="info_value">$fsize(torrent.total_payload_upload)</td>
|
||||
</tr>
|
||||
|
||||
<tr><td class="info_label">$_('Seeders'):</td>
|
||||
|
@ -41,10 +41,10 @@ $else:
|
|||
|
||||
<table>
|
||||
<tr><td class="info_label">$_('Speed'):</td><td class="info_value">
|
||||
$fspeed(torrent.download_rate)</td></td></tr>
|
||||
$fspeed(torrent.download_payload_rate)</td></td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Speed'):</td>
|
||||
<td class="info_value">$fspeed(torrent.upload_rate)</td></tr>
|
||||
<td class="info_value">$fspeed(torrent.upload_payload_rate)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Peers'):</td>
|
||||
<td class="info_value">$torrent.num_peers ($torrent.total_peers )</td></tr>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$def with (torrent)
|
||||
|
||||
$:(render.header(torrent.message + '/' + torrent.name))
|
||||
$:(render.header(_(torrent.state) + '/' + torrent.name))
|
||||
<div class="panel">
|
||||
$for id, title, image, flag, method, url, important in toolbar_items:
|
||||
$if (flag > 0) and (id != 'details'):
|
||||
|
@ -11,27 +11,6 @@ $for id, title, tab in detail_tabs:
|
|||
$:render[tab](torrent)
|
||||
|
||||
<br>
|
||||
<!--
|
||||
[<a onclick="javascript:toggle_dump()">$_('Debug:Data Dump')</a>]
|
||||
|
||||
<pre style="background-color:white;color:black;display:none" id="data_dump">
|
||||
$for key in sorted(torrent):
|
||||
$key : $torrent[key]
|
||||
</pre>
|
||||
|
||||
<script language="javascript">
|
||||
function toggle_dump(){
|
||||
el = document.getElementById("data_dump");
|
||||
if (el.style.display == "block"){
|
||||
el.style.display = "none";
|
||||
}
|
||||
else{
|
||||
el.style.display = "block";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
$:render.footer()
|
||||
|
|
|
@ -16,7 +16,9 @@ body, th, td,tr , div,table , div{
|
|||
border-spacing:0px;
|
||||
}
|
||||
|
||||
a { color: #0000AA;}
|
||||
a {
|
||||
color: #0000AA;
|
||||
}
|
||||
a:visited { color: #0000AA;}
|
||||
|
||||
th {font-weight:normal}
|
||||
|
@ -41,6 +43,14 @@ div.deluge_button{
|
|||
display:inline;
|
||||
}
|
||||
|
||||
div.panel {
|
||||
border-style:solid;
|
||||
border-width:12 2 2 12;
|
||||
border-color:#C3D9FF;
|
||||
-moz-border-radius:5px;
|
||||
width:700px;
|
||||
}
|
||||
|
||||
/*page from top to bottom:*/
|
||||
|
||||
/*top part :*/
|
||||
|
|
|
@ -149,15 +149,7 @@ def enhance_torrent_status(torrent_id,status):
|
|||
out: enhanced torrent_staus
|
||||
"""
|
||||
status = Storage(status)
|
||||
#add missing values for deluge 0.6:
|
||||
#todo : Remove this!, and clean up the rest
|
||||
for key in TORRENT_KEYS:
|
||||
if not key in status:
|
||||
status[key] = 0
|
||||
#log.warning('torrent_status:empty key in status:%s' % key)
|
||||
elif status[key] == None:
|
||||
status[key] = 0
|
||||
#log.warning('torrent_status:None key in status:%s' % key)
|
||||
|
||||
|
||||
if status.tracker == 0:
|
||||
#0.6 does not raise a decent error on non-existing torrent.
|
||||
|
@ -165,45 +157,12 @@ def enhance_torrent_status(torrent_id,status):
|
|||
|
||||
status["id"] = torrent_id
|
||||
|
||||
#0.5-->0.6
|
||||
status.download_rate = status.download_payload_rate
|
||||
status.upload_rate = status.upload_payload_rate
|
||||
|
||||
#for naming the status-images
|
||||
status.calc_state_str = "downloading"
|
||||
if status.paused:
|
||||
status.calc_state_str= "inactive"
|
||||
elif status.state <> 2:
|
||||
status.calc_state_str = "seeding"
|
||||
|
||||
#action for torrent_pause
|
||||
if status.paused: #no user-paused in 0.6 !!!
|
||||
status.action = "start"
|
||||
else:
|
||||
status.action = "stop"
|
||||
|
||||
status.message = _(status.state)
|
||||
|
||||
#add some pre-calculated values
|
||||
status.update({
|
||||
"calc_total_downloaded" : (fsize(status.total_done)
|
||||
+ " (" + "??" + ")"
|
||||
),
|
||||
"calc_total_uploaded": (fsize(
|
||||
#status.uploaded_memory +
|
||||
status.total_payload_upload) + " ("
|
||||
+ "??" + ")"),
|
||||
})
|
||||
|
||||
#no non-unicode string may enter the templates.
|
||||
#FIXED, was a translation bug..
|
||||
if debug_unicode:
|
||||
for k, v in status.iteritems():
|
||||
if (not isinstance(v, unicode)) and isinstance(v, str):
|
||||
try:
|
||||
status[k] = unicode(v)
|
||||
except:
|
||||
raise Exception('Non Unicode for key:%s' % (k, ))
|
||||
return status
|
||||
|
||||
def get_torrent_status(torrent_id):
|
||||
|
|
Loading…
Reference in New Issue