Implement 'Queue finished to bottom'.
This commit is contained in:
parent
def92cb735
commit
8562cad4f5
|
@ -564,8 +564,18 @@ class TorrentManager(component.Component):
|
|||
# Get the torrent_id
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
log.debug("%s is finished..", torrent_id)
|
||||
# Queue to bottom if enabled
|
||||
if alert.msg() == "torrent has finished downloading":
|
||||
if self.config["queue_finished_to_bottom"]:
|
||||
self.queue.bottom(torrent_id)
|
||||
|
||||
# Set the torrent state
|
||||
if self.queue.get_num_seeding() < self.config["max_active_seeding"] or\
|
||||
self.config["max_active_seeding"] == -1:
|
||||
self.torrents[torrent_id].set_state("Seeding")
|
||||
else:
|
||||
self.torrents[torrent_id].set_state("Queued")
|
||||
|
||||
# Write the fastresume file
|
||||
self.torrents[torrent_id].write_fastresume()
|
||||
|
||||
|
|
|
@ -51,6 +51,12 @@ class TorrentQueue(component.Component):
|
|||
self.torrents = component.get("TorrentManager")
|
||||
self.config = ConfigManager("core.conf")
|
||||
|
||||
# Register config set functions
|
||||
self.config.register_set_function("max_active_seeding",
|
||||
self._on_set_max_active_seeding, False)
|
||||
self.config.register_set_function("max_active_downloading",
|
||||
self._on_set_max_active_downloading, False)
|
||||
|
||||
def update(self):
|
||||
self.update_state_lists()
|
||||
self.update_max_active()
|
||||
|
@ -278,3 +284,9 @@ class TorrentQueue(component.Component):
|
|||
self.append(self.queue.pop(index))
|
||||
self.update_order()
|
||||
return True
|
||||
|
||||
def _on_set_max_active_seeding(self, key, value):
|
||||
self.update()
|
||||
|
||||
def _on_set_max_active_downloading(self, key, value):
|
||||
self.update()
|
||||
|
|
Loading…
Reference in New Issue