fix add torrent in webui

This commit is contained in:
Marcos Pinto 2007-11-24 20:39:55 +00:00
parent 9777d4e00c
commit ee409d71c5
3 changed files with 20 additions and 10 deletions

View File

@ -1,13 +1,18 @@
from __future__ import with_statement
import os
import re
template_dir = '~/prj/WebUi/templates/deluge'
template_dir = os.path.expanduser(template_dir )
template_dirs = ['~/prj/WebUi/templates/deluge',
'~/prj/WebUi/templates/advanced']
template_dirs = [os.path.expanduser(template_dir ) for template_dir in template_dirs]
files = [os.path.join(template_dir,fname)
for fname in os.listdir(template_dir)
if fname.endswith('.html')]
files = []
for template_dir in template_dirs:
files += [os.path.join(template_dir,fname)
for fname in os.listdir(template_dir)
if fname.endswith('.html')]
all_strings = []
for filename in files:

View File

@ -1,5 +1,6 @@
_('# Of Files')
_('About')
_('Add')
_('Add Torrent')
_('Add torrent')
_('Apply')
@ -13,6 +14,7 @@ _('Delete .torrent file')
_('Delete downloaded files.')
_('Details')
_('Disable')
_('Down')
_('Down Speed')
_('Download')
_('Downloaded')
@ -27,19 +29,20 @@ _('Next Announce')
_('Off')
_('Password')
_('Password is invalid,try again')
_('Pause')
_('Pause all')
_('Peers')
_('Pieces')
_('Progress')
_('Queue Down')
_('Queue Position')
_('Queue Up')
_('Queue pos:')
_('Ratio')
_('Reannounce')
_('Refresh page every:')
_('Remove')
_('Remove %s ')
_('Remove %s?')
_('Remove torrent')
_('Resume')
_('Resume all')
_('Seeders')
_('Set')
@ -47,11 +50,13 @@ _('Set Timeout')
_('Share Ratio')
_('Size')
_('Speed')
_('Start')
_('Submit')
_('Torrent list')
_('Total Size')
_('Tracker')
_('Tracker Status')
_('Up')
_('Up Speed')
_('Upload')
_('Upload torrent')

View File

@ -221,7 +221,7 @@ def get_torrent_status(torrent_id):
url = urlparse(status.tracker)
if hasattr(url,'hostname'):
status.category = url.hostname
status.category = url.hostname or 'unknown'
else:
status.category = 'No-tracker'
@ -265,7 +265,7 @@ def get_torrent_status(torrent_id):
return status
def get_categories(torrent_list):
trackers = [torrent['category'] for torrent in torrent_list]
trackers = [(torrent['category'] or 'unknown') for torrent in torrent_list]
categories = {}
for tracker in trackers:
categories[tracker] = categories.get(tracker,0) + 1