Update 'save_path' on storage_moved_alert.
This commit is contained in:
parent
db97daeeeb
commit
1a0718b4ac
|
@ -108,6 +108,9 @@ class Torrent:
|
||||||
def set_prioritize_first_last(self, prioritize):
|
def set_prioritize_first_last(self, prioritize):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_save_path(self, save_path):
|
||||||
|
self.save_path = save_path
|
||||||
|
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
"""Returns the state of this torrent for saving to the session state"""
|
"""Returns the state of this torrent for saving to the session state"""
|
||||||
status = self.handle.status()
|
status = self.handle.status()
|
||||||
|
|
|
@ -100,6 +100,8 @@ class TorrentManager(component.Component):
|
||||||
self.alerts.register_handler("tracker_alert", self.on_alert_tracker)
|
self.alerts.register_handler("tracker_alert", self.on_alert_tracker)
|
||||||
self.alerts.register_handler("tracker_warning_alert",
|
self.alerts.register_handler("tracker_warning_alert",
|
||||||
self.on_alert_tracker_warning)
|
self.on_alert_tracker_warning)
|
||||||
|
self.alerts.register_handler("storage_moved_alert",
|
||||||
|
self.on_alert_storage_moved)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
# Try to load the state from file
|
# Try to load the state from file
|
||||||
|
@ -611,3 +613,13 @@ class TorrentManager(component.Component):
|
||||||
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
self.torrents[torrent_id].set_tracker_status(tracker_status)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.debug("torrent_id doesn't exist.")
|
log.debug("torrent_id doesn't exist.")
|
||||||
|
|
||||||
|
def on_alert_storage_moved(self, alert):
|
||||||
|
log.debug("on_alert_storage_moved")
|
||||||
|
# Get the torrent_id
|
||||||
|
torrent_id = str(alert.handle.info_hash())
|
||||||
|
try:
|
||||||
|
self.torrents[torrent_id].set_save_path(alert.handle.save_path())
|
||||||
|
except KeyError:
|
||||||
|
log.debug("torrent_id doesn't exist.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue