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
parent 2afd0a4e97
commit 447cb52bf1
2 changed files with 18 additions and 12 deletions

View File

@ -257,7 +257,7 @@ dl.singleline dd {
}
/* 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;
background-repeat: no-repeat;
line-height: 16px;
@ -278,3 +278,7 @@ dl.singleline dd {
.x-highest-download {
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 = []
info = {}
dir_info = {}
for index, torrent_file in enumerate(files):
path = torrent_file["path"]
paths.append(path)
@ -542,17 +541,20 @@ class WebApi(JSONComponent):
info[path] = torrent_file
# update the directory info
dirinfo = info.setdefault(os.path.dirname(path), {})
dirinfo["size"] = dirinfo.get("size", 0) + torrent_file["size"]
if "priority" not in dirinfo:
dirinfo["priority"] = torrent_file["priority"]
else:
if dirinfo["priority"] != torrent_file["priority"]:
dirinfo["priority"] = 9
dirname = os.path.dirname(path)
while dirname:
dirinfo = info.setdefault(dirname, {})
dirinfo["size"] = dirinfo.get("size", 0) + torrent_file["size"]
if "priority" not in dirinfo:
dirinfo["priority"] = torrent_file["priority"]
else:
if dirinfo["priority"] != torrent_file["priority"]:
dirinfo["priority"] = 9
progresses = dirinfo.setdefault("progresses", [])
progresses.append(torrent_file["progress"])
dirinfo["progress"] = float(sum(progresses)) / len(progresses)
progresses = dirinfo.setdefault("progresses", [])
progresses.append(torrent_file["progress"])
dirinfo["progress"] = float(sum(progresses)) / len(progresses)
dirname = os.path.dirname(dirname)
def walk(path, item):
if item["type"] == "dir":