diff options
author | Chase Sterling <chase.sterling@gmail.com> | 2013-04-29 18:07:04 -0400 |
---|---|---|
committer | Chase Sterling <chase.sterling@gmail.com> | 2013-04-29 18:07:04 -0400 |
commit | 289730a3e32c80332447a51d7c6c366c2aa78ae7 (patch) | |
tree | 55729a77d5f31934c98bcc6a9cf6f15ec4ed2ae0 | |
parent | 1d34d5f6a59214075f0f351454400efa3103a1d1 (diff) | |
download | deluge-289730a3e32c80332447a51d7c6c366c2aa78ae7.tar.gz deluge-289730a3e32c80332447a51d7c6c366c2aa78ae7.tar.bz2 deluge-289730a3e32c80332447a51d7c6c366c2aa78ae7.zip |
Make sure prioritize first/last doesn't enable pieces in
a file marked do not download. refs #2211
-rw-r--r-- | deluge/core/torrent.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 50f0d7709..99ba11a0d 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -318,12 +318,10 @@ class Torrent(object): prioritized_pieces.append((first_start, first_end)) prioritized_pieces.append((last_start, last_end)) - # Creating two lists with priorites for the first/last pieces - # of this file, and insert the priorities into the list - first_list = [7] * (first_end - first_start) - last_list = [7] * (last_end - last_start) - priorities[first_start:first_end] = first_list - priorities[last_start:last_end] = last_list + # Set the pieces in our first and last ranges to priority 7 + # if they are not marked as do not download + priorities[first_start:first_end] = map(lambda p: p and 7, priorities[first_start:first_end]) + priorities[last_start:last_end] = map(lambda p: p and 7, priorities[last_start:last_end]) # Setting the priorites for all the pieces of this torrent self.handle.prioritize_pieces(priorities) return prioritized_pieces, priorities |