prevent infinite recursion in apply_queue
This commit is contained in:
parent
cb4358f65e
commit
2be048d89e
12
src/core.py
12
src/core.py
|
@ -403,27 +403,30 @@ class Manager:
|
||||||
|
|
||||||
# Queueing functions
|
# Queueing functions
|
||||||
|
|
||||||
def queue_up(self, unique_ID):
|
def queue_up(self, unique_ID, enforce_queue=True):
|
||||||
curr_index = self.get_queue_index(unique_ID)
|
curr_index = self.get_queue_index(unique_ID)
|
||||||
if curr_index > 0:
|
if curr_index > 0:
|
||||||
temp = self.state.queue[curr_index - 1]
|
temp = self.state.queue[curr_index - 1]
|
||||||
self.state.queue[curr_index - 1] = unique_ID
|
self.state.queue[curr_index - 1] = unique_ID
|
||||||
self.state.queue[curr_index] = temp
|
self.state.queue[curr_index] = temp
|
||||||
|
if enforce_queue:
|
||||||
self.apply_queue()
|
self.apply_queue()
|
||||||
|
|
||||||
def queue_down(self, unique_ID):
|
def queue_down(self, unique_ID, enforce_queue=True):
|
||||||
curr_index = self.get_queue_index(unique_ID)
|
curr_index = self.get_queue_index(unique_ID)
|
||||||
if curr_index < (len(self.state.queue) - 1):
|
if curr_index < (len(self.state.queue) - 1):
|
||||||
temp = self.state.queue[curr_index + 1]
|
temp = self.state.queue[curr_index + 1]
|
||||||
self.state.queue[curr_index + 1] = unique_ID
|
self.state.queue[curr_index + 1] = unique_ID
|
||||||
self.state.queue[curr_index] = temp
|
self.state.queue[curr_index] = temp
|
||||||
|
if enforce_queue:
|
||||||
self.apply_queue()
|
self.apply_queue()
|
||||||
|
|
||||||
def queue_bottom(self, unique_ID):
|
def queue_bottom(self, unique_ID, enforce_queue=True):
|
||||||
curr_index = self.get_queue_index(unique_ID)
|
curr_index = self.get_queue_index(unique_ID)
|
||||||
if curr_index < (len(self.state.queue) - 1):
|
if curr_index < (len(self.state.queue) - 1):
|
||||||
self.state.queue.remove(curr_index)
|
self.state.queue.remove(curr_index)
|
||||||
self.state.queue.append(unique_ID)
|
self.state.queue.append(unique_ID)
|
||||||
|
if enforce_queue:
|
||||||
self.apply_queue()
|
self.apply_queue()
|
||||||
|
|
||||||
def clear_completed(self):
|
def clear_completed(self):
|
||||||
|
@ -447,8 +450,7 @@ class Manager:
|
||||||
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.get_pref('auto_seed_ratio'):
|
if ratio >= self.get_pref('auto_seed_ratio'):
|
||||||
self.queue_bottom(unique_ID)
|
self.queue_bottom(unique_ID, enforce_queue=False) # don't recurse!
|
||||||
|
|
||||||
|
|
||||||
# Pause and resume torrents
|
# Pause and resume torrents
|
||||||
for index in range(len(self.state.queue)):
|
for index in range(len(self.state.queue)):
|
||||||
|
|
Loading…
Reference in New Issue