From 8588a6e83c125508e3771a1d081045c98dd4ed5e Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 15 Jun 2008 03:31:33 +0000 Subject: [PATCH] Fix prioritize_first_last --- deluge/core/torrent.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 12fc8a556..c57aaaf72 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -146,13 +146,14 @@ class Torrent: self.handle.set_download_limit(int(m_down_speed * 1024)) def set_prioritize_first_last(self, prioritize): - if self.handle.get_torrent_info().num_files() == 1: - # We only do this if one file is in the torrent - self.prioritize_first_last = prioritize - priorities = [1] * self.handle.get_torrent_info().num_pieces() - priorities[0] = 7 - priorities[-1] = 7 - self.handle.prioritize_pieces(priorities) + self.prioritize_first_last = prioritize + if self.prioritize_first_last: + if self.handle.get_torrent_info().num_files() == 1: + # We only do this if one file is in the torrent + priorities = [1] * self.handle.get_torrent_info().num_pieces() + priorities[0] = 7 + priorities[-1] = 7 + self.handle.prioritize_pieces(priorities) def set_save_path(self, save_path): self.save_path = save_path