Fix prioritize_first_last

This commit is contained in:
Andrew Resch 2008-06-15 03:31:33 +00:00
parent f769429e1d
commit 8588a6e83c
1 changed files with 8 additions and 7 deletions

View File

@ -146,13 +146,14 @@ class Torrent:
self.handle.set_download_limit(int(m_down_speed * 1024)) self.handle.set_download_limit(int(m_down_speed * 1024))
def set_prioritize_first_last(self, prioritize): def set_prioritize_first_last(self, prioritize):
if self.handle.get_torrent_info().num_files() == 1: self.prioritize_first_last = prioritize
# We only do this if one file is in the torrent if self.prioritize_first_last:
self.prioritize_first_last = prioritize if self.handle.get_torrent_info().num_files() == 1:
priorities = [1] * self.handle.get_torrent_info().num_pieces() # We only do this if one file is in the torrent
priorities[0] = 7 priorities = [1] * self.handle.get_torrent_info().num_pieces()
priorities[-1] = 7 priorities[0] = 7
self.handle.prioritize_pieces(priorities) priorities[-1] = 7
self.handle.prioritize_pieces(priorities)
def set_save_path(self, save_path): def set_save_path(self, save_path):
self.save_path = save_path self.save_path = save_path