add .x-mixed-download to the priorities css

fix the way the directory stats are updated (parent directories weren't being updated)
This commit is contained in:
Damien Churchill 2010-01-26 13:25:44 +00:00
commit 447cb52bf1
2 changed files with 18 additions and 12 deletions

View file

@ -257,7 +257,7 @@ dl.singleline dd {
} }
/* Filepriority styles */ /* Filepriority styles */
.x-no-download, .x-normal-download, .x-high-download, .x-highest-download { .x-no-download, .x-normal-download, .x-high-download, .x-highest-download, .x-mixed-download {
padding-left: 20px; padding-left: 20px;
background-repeat: no-repeat; background-repeat: no-repeat;
line-height: 16px; line-height: 16px;
@ -278,3 +278,7 @@ dl.singleline dd {
.x-highest-download { .x-highest-download {
background-image: url(/icons/highest.png); background-image: url(/icons/highest.png);
} }
.x-mixed-download {
/*background-image: url(/icons/mixed.png);*/
}

View file

@ -532,7 +532,6 @@ class WebApi(JSONComponent):
paths = [] paths = []
info = {} info = {}
dir_info = {}
for index, torrent_file in enumerate(files): for index, torrent_file in enumerate(files):
path = torrent_file["path"] path = torrent_file["path"]
paths.append(path) paths.append(path)
@ -542,17 +541,20 @@ class WebApi(JSONComponent):
info[path] = torrent_file info[path] = torrent_file
# update the directory info # update the directory info
dirinfo = info.setdefault(os.path.dirname(path), {}) dirname = os.path.dirname(path)
dirinfo["size"] = dirinfo.get("size", 0) + torrent_file["size"] while dirname:
if "priority" not in dirinfo: dirinfo = info.setdefault(dirname, {})
dirinfo["priority"] = torrent_file["priority"] dirinfo["size"] = dirinfo.get("size", 0) + torrent_file["size"]
else: if "priority" not in dirinfo:
if dirinfo["priority"] != torrent_file["priority"]: dirinfo["priority"] = torrent_file["priority"]
dirinfo["priority"] = 9 else:
if dirinfo["priority"] != torrent_file["priority"]:
dirinfo["priority"] = 9
progresses = dirinfo.setdefault("progresses", []) progresses = dirinfo.setdefault("progresses", [])
progresses.append(torrent_file["progress"]) progresses.append(torrent_file["progress"])
dirinfo["progress"] = float(sum(progresses)) / len(progresses) dirinfo["progress"] = float(sum(progresses)) / len(progresses)
dirname = os.path.dirname(dirname)
def walk(path, item): def walk(path, item):
if item["type"] == "dir": if item["type"] == "dir":