diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 6d658f63c..94898b20e 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -75,6 +75,7 @@ class TorrentOptions(dict): for opt_k, conf_k in options_conf_map.iteritems(): self[opt_k] = config[conf_k] self["file_priorities"] = [] + self["mapped_files"] = {} class Torrent: """Torrent holds information about torrents added to the libtorrent session. diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index a4a9931b8..635e9db89 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -340,6 +340,12 @@ class TorrentManager(component.Component): o.update(options) options = o + # Check for renamed files and if so, rename them in the torrent_info + # before adding to the session. + if options["mapped_files"]: + for index, name in options["mapped_files"].items(): + torrent_info.rename_file(index, name) + add_torrent_params["ti"] = torrent_info add_torrent_params["resume_data"] = ""