edit trackers

This commit is contained in:
Martijn Voncken 2008-04-03 18:32:58 +00:00
parent 3185665941
commit c585e75b36
2 changed files with 30 additions and 6 deletions

View File

@ -183,7 +183,8 @@ route("/torrent/delete/(.*)",torrent_delete)
class torrent_files: class torrent_files:
@deco.check_session @deco.check_session
def POST(self, torrent_id): @deco.torrent
def POST(self, torrent):
torrent = get_torrent_status(torrent_id) torrent = get_torrent_status(torrent_id)
file_priorities = web.input(file_priorities=[]).file_priorities file_priorities = web.input(file_priorities=[]).file_priorities
#file_priorities contains something like ['0','2','3','4'] #file_priorities contains something like ['0','2','3','4']
@ -191,10 +192,24 @@ class torrent_files:
proxy_prio = [0 for x in xrange(len(torrent.file_priorities))] proxy_prio = [0 for x in xrange(len(torrent.file_priorities))]
for pos in file_priorities: for pos in file_priorities:
proxy_prio[int(pos)] = 1 proxy_prio[int(pos)] = 1
proxy.set_torrent_file_priorities(torrent_id, proxy_prio) proxy.set_torrent_file_priorities(torrent.id, proxy_prio)
do_redirect() do_redirect()
route("/torrent/files/(.*)", torrent_files) route("/torrent/files/(.*)", torrent_files)
class torrent_trackers:
@deco.check_session
@deco.torrent
def POST(self, torrent):
vars = web.input(tier=[], url=[])
tiers_int = [int(t) for t in vars.tier]
sorted_urls = [url for num,url in sorted(zip(tiers_int, vars.url)) if url]
trackers = [{'tier':i , 'url':url} for i,url in enumerate(sorted_urls)]
proxy.set_torrent_trackers(torrent.id, trackers)
do_redirect()
route("/torrent/trackers/(.*)", torrent_trackers)
class pause_all: class pause_all:
@deco.check_session @deco.check_session
def POST(self, name): def POST(self, name):

View File

@ -1,5 +1,6 @@
$def with (torrent) $def with (torrent)
<form method="POST" action="$base/torrent/trackers/$torrent.id">
<input type="hidden" name="redir" value="$self_url()">
<table width="95%"> <table width="95%">
$altrow(True) $altrow(True)
<tr class="tab_$altrow()"> <tr class="tab_$altrow()">
@ -8,9 +9,17 @@ $altrow(True)
$for tracker in torrent.trackers: $for tracker in torrent.trackers:
<tr class="tab_$altrow()" > <tr class="tab_$altrow()" >
<td > <td >
$tracker['tier'] <input type="text" name="tier" value="$tracker['tier']" style="width:20px"/>
</td> </td>
<td title="tracker">$crop(tracker['url'], 60)</td> <td><input type="text" name="url" value="$tracker['url']" style="width:400px"//></td>
</tr>
<tr class="tab_$altrow()" >
<td >
<input type="text" name="tier" value="$(tracker['tier'] + 1)" style="width:20px"/>
</td>
<td><input type="text" name="url" value="" style="width:400px"//></td>
</tr> </tr>
</table>
</table>
<input type="submit" value="$_('Update')">
</form>