move tracker icon cache folder

This commit is contained in:
Martijn Voncken 2008-10-24 18:16:12 +00:00
parent 29c32c0b6a
commit 56a3a03a59
3 changed files with 10 additions and 7 deletions

View File

@ -43,8 +43,7 @@ from urlparse import urlparse
import traceback
import re
RE_VALID = re.compile("[a-z0-9_-]*\Z")
RE_VALID = re.compile("[a-z0-9_-]*\Z")
RE_VALID = re.compile("[a-z0-9_\-\.]*\Z")
KNOWN_STATES = ['Downloading','Seeding','Paused','Checking','Queued','Error']
STATE = "state"

View File

@ -6,12 +6,12 @@ from deluge.tracker_icons import TrackerIcons
from deluge.common import get_default_config_dir
def del_old():
filename = os.path.join(get_default_config_dir("trackers"),"legaltorrents.com.ico")
filename = os.path.join(get_default_config_dir("icons"),"legaltorrents.com.ico")
if os.path.exists(filename):
os.remove(filename)
def test_get():
#del_old()
del_old()
trackericons = TrackerIcons()
print trackericons.images
print trackericons.get("unknown2")

View File

@ -40,13 +40,17 @@ from deluge.common import get_default_config_dir, get_pixmap
import os
#some servers don't have their favicon at the expected location
RENAMES = {"legaltorrents.com":"beta.legaltorrents.com"}
RENAMES = {
"legaltorrents.com":"beta.legaltorrents.com",
"aelitis.com":"www.vuze.com"
}
VALID_TYPES = ["octet-stream","x-icon"]
class TrackerIcons(object):
def __init__(self):
#set image cache dir
self.image_dir = get_default_config_dir("trackers")
self.image_dir = get_default_config_dir("icons")
if not os.path.exists(self.image_dir):
os.mkdir(self.image_dir)
@ -79,7 +83,7 @@ class TrackerIcons(object):
log.debug("%s %s %s" % (tracker_host, e, e.message))
return False
filename = os.path.join(get_default_config_dir("trackers"),"%s.ico" % tracker_host)
filename = os.path.join(get_default_config_dir("icons"),"%s.ico" % tracker_host)
f = open(filename,"wb")
f.write(icon_data)