mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-03 07:03:39 +00:00
Add ability to rename files prior to adding with the option "mapped_files" which is a dictionary of {index: filename, ...}
This commit is contained in:
parent
6fb180ed23
commit
0a9a6b4816
@ -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.
|
||||
|
@ -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"] = ""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user