summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2013-02-11 22:09:46 -0500
committerChase Sterling <chase.sterling@gmail.com>2013-02-11 22:09:46 -0500
commit891160015532f3954cf655cbf678040ee60cc5be (patch)
treea0499b12bf691cedd6ba11641b7aedf0a969cdc8
parentc58221c866e65b43ee03db83db51aad776a6f7a6 (diff)
downloaddeluge-891160015532f3954cf655cbf678040ee60cc5be.tar.gz
deluge-891160015532f3954cf655cbf678040ee60cc5be.tar.bz2
deluge-891160015532f3954cf655cbf678040ee60cc5be.zip
Fix prioritize first/last pieces for magnet links
-rw-r--r--ChangeLog1
-rw-r--r--deluge/core/torrent.py5
-rw-r--r--deluge/core/torrentmanager.py2
3 files changed, 7 insertions, 1 deletions
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())