From 891160015532f3954cf655cbf678040ee60cc5be Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Mon, 11 Feb 2013 22:09:46 -0500 Subject: [PATCH] Fix prioritize first/last pieces for magnet links --- ChangeLog | 1 + deluge/core/torrent.py | 5 +++++ deluge/core/torrentmanager.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4966bc2b9..a1763dea8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ * #2109: Fix the Proxy settings not being cleared by setting None * #2110: Fix accepting magnet uris with xt param anywhere within them * #2204: Fix daemon shutdown hang with large numbers of torrents + * Fix prioritize first/last pieces option for magnet links ==== Client ==== * Fix keyerrors after removing torrents from UIs diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 895fd6240..e46b16b37 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -868,6 +868,11 @@ class Torrent(object): self.handle.save_resume_data() self.waiting_on_resume_data = True + def on_metadata_received(self): + if self.options["prioritize_first_last_pieces"]: + self.set_prioritize_first_last(True) + self.write_torrentfile() + def write_torrentfile(self): """Writes the torrent file""" path = "%s/%s.torrent" % ( diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 3dae4e0dc..6254ffe59 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -1110,7 +1110,7 @@ class TorrentManager(component.Component): torrent = self.torrents[str(alert.handle.info_hash())] except: return - torrent.write_torrentfile() + torrent.on_metadata_received() def on_alert_file_error(self, alert): log.debug("on_alert_file_error: %s", alert.message())