Some queue above completed feature touch ups. Thanks, eternalswd.

This commit is contained in:
Alex Dedul 2007-07-18 13:06:22 +00:00
parent 280f4dfb10
commit a7ce81d4d0
1 changed files with 5 additions and 5 deletions

View File

@ -240,7 +240,7 @@ class Manager:
# Sync with the core: tell core about torrents, and get # Sync with the core: tell core about torrents, and get
# unique_IDs # unique_IDs
self.sync() self.sync(True)
# Apply all the file priorities, right after adding the # Apply all the file priorities, right after adding the
# torrents # torrents
@ -762,7 +762,7 @@ class Manager:
## Some of these changes may be hack-ish, so look at them and make ## Some of these changes may be hack-ish, so look at them and make
## sure nothing is wrong. ## sure nothing is wrong.
## ##
def sync(self): def sync(self, called_on_start=False):
ret = None # We return new added unique ID(s), or None ret = None # We return new added unique ID(s), or None
no_space = False no_space = False
@ -810,16 +810,16 @@ class Manager:
for unique_ID in self.unique_IDs.keys(): for unique_ID in self.unique_IDs.keys():
if unique_ID not in self.state.queue: if unique_ID not in self.state.queue:
if self.get_pref('queue_above_completed') and \ if self.get_pref('queue_above_completed') and \
len(self.state.queue) > 0: len(self.state.queue) > 0 and not called_on_start:
for index in xrange(len(self.state.queue)): for index in xrange(len(self.state.queue)):
torrent_state = self.get_core_torrent_state(self.state.queue[index]) torrent_state = self.get_core_torrent_state(
self.state.queue[index])
if torrent_state['progress'] == 1.0: if torrent_state['progress'] == 1.0:
break break
if torrent_state['progress'] == 1.0: if torrent_state['progress'] == 1.0:
self.state.queue.insert(index, unique_ID) self.state.queue.insert(index, unique_ID)
else: else:
self.state.queue.append(unique_ID) self.state.queue.append(unique_ID)
else: else:
self.state.queue.append(unique_ID) self.state.queue.append(unique_ID)
# run through queue, remove those that no longer exists # run through queue, remove those that no longer exists