From 289730a3e32c80332447a51d7c6c366c2aa78ae7 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Mon, 29 Apr 2013 18:07:04 -0400 Subject: [PATCH] Make sure prioritize first/last doesn't enable pieces in a file marked do not download. refs #2211 --- deluge/core/torrent.py | 10 ++++------ 1 file 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