From e70dd1c7177649f33caa8bdbf00eac3d17a989d2 Mon Sep 17 00:00:00 2001 From: sanek9 Date: Thu, 26 Sep 2013 22:00:52 +0300 Subject: [PATCH] Update core.py --- pieces/core.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pieces/core.py b/pieces/core.py index 7ea317e..7186c9f 100644 --- a/pieces/core.py +++ b/pieces/core.py @@ -111,6 +111,13 @@ def piece_priorities(self, selected, priority): @export def add_priority_torrent(self, torr): "add a torrent to have first un-downloaded piece priority boosted" + tor = component.get("TorrentManager").torrents[torr] + lenth = len(tor.status.pieces) + i=0 + while i < lenth: + if not(tor.status.pieces[i]) and (tor.handle.piece_priority(i) != 0): + tor.handle.piece_priority(i, 1) + i=i+1 self.priority_torrents[torr] = True @export