remove try block

This commit is contained in:
Zach Tibbitts 2007-02-27 01:05:05 +00:00
parent 745872efde
commit 4f216a6f2e
1 changed files with 17 additions and 20 deletions

View File

@ -421,28 +421,25 @@ class Manager:
# ___ALL queuing code should be in this function, and ONLY here___ # ___ALL queuing code should be in this function, and ONLY here___
def apply_queue(self, efficient = True): def apply_queue(self, efficient = True):
# Handle autoseeding - downqueue as needed # Handle autoseeding - downqueue as needed
try: if self.auto_seed_ratio != -1:
if self.auto_seed_ratio != -1: for unique_ID in self.unique_IDs:
for unique_ID in self.unique_IDs: if self.get_core_torrent_state(unique_ID, efficient)['is_seed']:
if self.get_core_torrent_state(unique_ID, efficient)['is_seed']: torrent_state = self.get_core_torrent_state(unique_ID, efficient)
torrent_state = self.get_core_torrent_state(unique_ID, efficient) ratio = self.calc_ratio(unique_ID, torrent_state)
ratio = self.calc_ratio(unique_ID, torrent_state) if ratio >= self.auto_seed_ratio:
if ratio >= self.auto_seed_ratio: self.queue_bottom(unique_ID)
self.queue_bottom(unique_ID)
# Pause and resume torrents # Pause and resume torrents
for index in range(len(self.state.queue)): for index in range(len(self.state.queue)):
unique_ID = self.state.queue[index] unique_ID = self.state.queue[index]
if (index < self.state.max_active_torrents or self.state_max_active_torrents == -1) \ if (index < self.state.max_active_torrents or self.state_max_active_torrents == -1) \
and self.get_core_torrent_state(unique_ID, efficient)['is_paused'] \ and self.get_core_torrent_state(unique_ID, efficient)['is_paused'] \
and not self.is_user_paused(unique_ID): and not self.is_user_paused(unique_ID):
deluge_core.resume(unique_ID) deluge_core.resume(unique_ID)
elif not self.get_core_torrent_state(unique_ID, efficient)['is_paused'] and \ elif not self.get_core_torrent_state(unique_ID, efficient)['is_paused'] and \
(index >= self.state.max_active_torrents or self.is_user_paused(unique_ID)): (index >= self.state.max_active_torrents or self.is_user_paused(unique_ID)):
deluge_core.pause(unique_ID) deluge_core.pause(unique_ID)
except AttributeError:
pass
# Event handling # Event handling