diff options
author | Cyker Way <cykerway@gmail.com> | 2018-01-20 16:45:33 -0500 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2018-09-26 14:27:04 +0100 |
commit | e050905b291f4d9b417270e38f2aa04366057919 (patch) | |
tree | 7ed0d6052427b9aa73563237993715d7ad01380b | |
parent | 6c3442e7e7fa68ab23270617c9f1d33147e624ef (diff) | |
download | deluge-e050905b291f4d9b417270e38f2aa04366057919.tar.gz deluge-e050905b291f4d9b417270e38f2aa04366057919.tar.bz2 deluge-e050905b291f4d9b417270e38f2aa04366057919.zip |
Save copies of torrent files from magnet links.archive/1.3-stable
This patch is meant for 1.3-stable (1.3.15 as of the commit date).
The bug is: when you add a new magnet link to download, even if you tick
the option *Copy of .torrent files to:*, deluge still fails to save a
copy of torrent. This patch adds extra code to do so.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | deluge/core/torrent.py | 7 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,8 @@ +=== Deluge 1.3.16 (unreleased) === + +==== Core ==== + * Fix saving copy of torrent file for magnet links. + === Deluge 1.3.15 (12 May 2017) === ==== Core ==== diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 6e1727a59..8b18ee147 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -144,7 +144,7 @@ class Torrent(object): # We store the filename just in case we need to make a copy of the torrentfile if not filename: # If no filename was provided, then just use the infohash - filename = self.torrent_id + filename = self.torrent_id + '.torrent' self.filename = filename @@ -972,6 +972,11 @@ class Torrent(object): torrent_file["info"] = md with open(path, "wb") as _file: _file.write(lt.bencode(torrent_file)) + if self.config["copy_torrent_file"]: + config_dir = self.config['torrentfiles_location'] + filepath = os.path.join(config_dir, self.filename) + with open(filepath, "wb") as _file: + _file.write(lt.bencode(torrent_file)) except Exception, e: log.warning("Unable to save torrent file: %s", e) |