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 from __future__ import with_statement
import os import os
import re import re
template_dir = '~/prj/WebUi/templates/deluge' template_dirs = ['~/prj/WebUi/templates/deluge',
template_dir = os.path.expanduser(template_dir ) '~/prj/WebUi/templates/advanced']
template_dirs = [os.path.expanduser(template_dir ) for template_dir in template_dirs]
files = [os.path.join(template_dir,fname) files = []
for fname in os.listdir(template_dir) for template_dir in template_dirs:
if fname.endswith('.html')] files += [os.path.join(template_dir,fname)
for fname in os.listdir(template_dir)
if fname.endswith('.html')]
all_strings = [] all_strings = []
for filename in files: for filename in files:

View File

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

View File

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