Re-apply per-torrent settings after forced recheck.
This commit is contained in:
parent
4b620896a5
commit
49af682226
|
@ -110,6 +110,9 @@ class Torrent:
|
|||
self.files = self.get_files()
|
||||
# Set the default file priorities to normal
|
||||
self.file_priorities = [1]* len(self.files)
|
||||
|
||||
# Set resolve_countries to True
|
||||
self.handle.resolve_countries(True)
|
||||
|
||||
log.debug("Torrent object created.")
|
||||
|
||||
|
@ -344,6 +347,16 @@ class Torrent:
|
|||
status_dict[key] = fns[key]()
|
||||
|
||||
return status_dict
|
||||
|
||||
def apply_options(self):
|
||||
"""Applies the per-torrent options that are set."""
|
||||
self.handle.set_max_connections(self.max_connections)
|
||||
self.handle.set_max_uploads(self.max_upload_slots)
|
||||
self.handle.set_upload_limit(int(self.max_upload_speed * 1024))
|
||||
self.handle.set_download_limit(int(self.max_download_speed * 1024))
|
||||
self.handle.get_torrent_info().set_priv(self.private)
|
||||
self.handle.prioritize_files(self.file_priorities)
|
||||
self.handle.resolve_countries(True)
|
||||
|
||||
def pause(self):
|
||||
"""Pause this torrent"""
|
||||
|
|
|
@ -285,10 +285,7 @@ class TorrentManager(component.Component):
|
|||
self.queue.insert(0, torrent.torrent_id)
|
||||
else:
|
||||
self.queue.insert(queue, torrent.torrent_id)
|
||||
|
||||
# Set resolve_countries to True
|
||||
handle.resolve_countries(True)
|
||||
|
||||
|
||||
# Set per-torrent options
|
||||
torrent.set_max_connections(options["max_connections_per_torrent"])
|
||||
torrent.set_max_upload_slots(options["max_upload_slots_per_torrent"])
|
||||
|
@ -455,6 +452,9 @@ class TorrentManager(component.Component):
|
|||
# The torrent was not added to the session
|
||||
return False
|
||||
|
||||
# Set all the per-torrent options
|
||||
torrent.apply_options()
|
||||
|
||||
# Set the state to Checking
|
||||
torrent.set_state("Checking")
|
||||
|
||||
|
|
Loading…
Reference in New Issue