mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-27 13:15:31 +00:00
Save copies of torrent files from magnet links.
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.
This commit is contained in:
parent
6c3442e7e7
commit
e050905b29
2 changed files with 11 additions and 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) ===
|
=== Deluge 1.3.15 (12 May 2017) ===
|
||||||
|
|
||||||
==== Core ====
|
==== Core ====
|
||||||
|
|
|
@ -144,7 +144,7 @@ class Torrent(object):
|
||||||
# We store the filename just in case we need to make a copy of the torrentfile
|
# We store the filename just in case we need to make a copy of the torrentfile
|
||||||
if not filename:
|
if not filename:
|
||||||
# If no filename was provided, then just use the infohash
|
# If no filename was provided, then just use the infohash
|
||||||
filename = self.torrent_id
|
filename = self.torrent_id + '.torrent'
|
||||||
|
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
||||||
|
@ -972,6 +972,11 @@ class Torrent(object):
|
||||||
torrent_file["info"] = md
|
torrent_file["info"] = md
|
||||||
with open(path, "wb") as _file:
|
with open(path, "wb") as _file:
|
||||||
_file.write(lt.bencode(torrent_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:
|
except Exception, e:
|
||||||
log.warning("Unable to save torrent file: %s", e)
|
log.warning("Unable to save torrent file: %s", e)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue