summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2012-11-13 01:36:04 -0500
committerChase Sterling <chase.sterling@gmail.com>2012-11-13 01:36:04 -0500
commit9d28aa9521ee4e6f424b6cd5dc694a15a0e394ae (patch)
tree66d9acfb32dfa560deafdc1cd2f2d6d7b64b9dd2
parent8298a93dcc19f3f02de5f8763d17a4ab3a2cd392 (diff)
downloaddeluge-9d28aa9521ee4e6f424b6cd5dc694a15a0e394ae.tar.gz
deluge-9d28aa9521ee4e6f424b6cd5dc694a15a0e394ae.tar.bz2
deluge-9d28aa9521ee4e6f424b6cd5dc694a15a0e394ae.zip
Fix bug in prioritize_first_last, also fixes selective downloading. refs #2211
-rw-r--r--deluge/core/torrent.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index d244be610..cafec162c 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -315,14 +315,14 @@ class Torrent(object):
for n in range(ti.num_pieces()):
slices = ti.map_block(n, 0, ti.piece_size(n))
for slice in slices:
- fe = ti.file_at(slice.file_index)
- paths.setdefault(fe.path, []).append(n)
+ if self.handle.file_priority(slice.file_index):
+ paths.setdefault(slice.file_index, []).append(n)
priorities = self.handle.piece_priorities()
for pieces in paths.itervalues():
- two_percent = 2*100/len(pieces)
+ two_percent = int(0.02*len(pieces)) or 1
for piece in pieces[:two_percent]+pieces[-two_percent:]:
- priorities[piece] = prioritize and 7 or 1
+ priorities[piece] = 7 if prioritize else 1
self.handle.prioritize_pieces(priorities)
def set_sequential_download(self, set_sequencial):