Re-apply per-torrent settings after forced recheck.
This commit is contained in:
parent
4b620896a5
commit
49af682226
|
@ -111,6 +111,9 @@ class Torrent:
|
||||||
# Set the default file priorities to normal
|
# Set the default file priorities to normal
|
||||||
self.file_priorities = [1]* len(self.files)
|
self.file_priorities = [1]* len(self.files)
|
||||||
|
|
||||||
|
# Set resolve_countries to True
|
||||||
|
self.handle.resolve_countries(True)
|
||||||
|
|
||||||
log.debug("Torrent object created.")
|
log.debug("Torrent object created.")
|
||||||
|
|
||||||
def set_tracker_status(self, status):
|
def set_tracker_status(self, status):
|
||||||
|
@ -345,6 +348,16 @@ class Torrent:
|
||||||
|
|
||||||
return status_dict
|
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):
|
def pause(self):
|
||||||
"""Pause this torrent"""
|
"""Pause this torrent"""
|
||||||
if self.state == "Queued":
|
if self.state == "Queued":
|
||||||
|
|
|
@ -286,9 +286,6 @@ class TorrentManager(component.Component):
|
||||||
else:
|
else:
|
||||||
self.queue.insert(queue, torrent.torrent_id)
|
self.queue.insert(queue, torrent.torrent_id)
|
||||||
|
|
||||||
# Set resolve_countries to True
|
|
||||||
handle.resolve_countries(True)
|
|
||||||
|
|
||||||
# Set per-torrent options
|
# Set per-torrent options
|
||||||
torrent.set_max_connections(options["max_connections_per_torrent"])
|
torrent.set_max_connections(options["max_connections_per_torrent"])
|
||||||
torrent.set_max_upload_slots(options["max_upload_slots_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
|
# The torrent was not added to the session
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Set all the per-torrent options
|
||||||
|
torrent.apply_options()
|
||||||
|
|
||||||
# Set the state to Checking
|
# Set the state to Checking
|
||||||
torrent.set_state("Checking")
|
torrent.set_state("Checking")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue