@@ -89,6 +89,7 @@ def _show_status(self):
8989 if not self ._handle .is_valid ():
9090 return
9191 status = self ._handle .status ()
92+ self ._base_path = status .save_path
9293 if status .has_metadata :
9394 self .size = status .total_wanted
9495 self .total_wanted_done = status .total_wanted_done
@@ -99,7 +100,6 @@ def _show_status(self):
99100 log .info ("Metadata completed for btih:%s - %s" , status .info_hash , self .name )
100101 # prioritize first 2mb
101102 self .prioritize (self .largest_file_index , 0 , 2 * 1024 * 1024 )
102- self ._base_path = status .save_path
103103 first_piece = self .torrent_file .piece_index_at_file (self .largest_file_index )
104104 if not self .started .is_set ():
105105 if self ._handle .have_piece (first_piece ):
@@ -117,7 +117,7 @@ def prioritize(self, file_index, start, end, cleanup=False):
117117 priorities = self ._handle .get_piece_priorities ()
118118 priorities = [0 if cleanup else 1 for _ in priorities ]
119119 self ._handle .clear_piece_deadlines ()
120- for idx , piece_number in enumerate (range (first_piece .piece , last_piece .piece + 1 )):
120+ for idx , piece_number in enumerate (range (first_piece .piece , last_piece .piece )):
121121 priorities [piece_number ] = 7 - idx if 0 <= idx <= 6 else 1
122122 self ._handle .set_piece_deadline (piece_number , idx )
123123 log .debug ("Prioritizing pieces for %s: %s" , self .name , priorities )
0 commit comments