Change add_torrent_magnets to add_torrent_magnet
Have add_torrent_magnet return a torrent_id on successful add
This commit is contained in:
parent
054ab20402
commit
2ced8ad189
|
@ -293,15 +293,17 @@ class Core(component.Component):
|
|||
return d
|
||||
|
||||
@export
|
||||
def add_torrent_magnets(self, uris, options):
|
||||
for uri in uris:
|
||||
log.debug("Attempting to add by magnet uri: %s", uri)
|
||||
try:
|
||||
option = options[uris.index(uri)]
|
||||
except IndexError:
|
||||
option = None
|
||||
def add_torrent_magnet(self, uri, options):
|
||||
"""
|
||||
Adds a torrent from a magnet link.
|
||||
|
||||
torrent_id = self.torrentmanager.add(magnet=uri, options=option)
|
||||
:param uri: str, the magnet link
|
||||
:param options: dict, the options to apply to the torrent on add
|
||||
|
||||
"""
|
||||
log.debug("Attempting to add by magnet uri: %s", uri)
|
||||
|
||||
return self.torrentmanager.add(magnet=uri, options=options)
|
||||
|
||||
@export
|
||||
def remove_torrent(self, torrent_ids, remove_data):
|
||||
|
|
|
@ -751,7 +751,8 @@ class AddTorrentDialog(component.Component):
|
|||
base64.encodestring(open(f, "rb").read()),
|
||||
torrent_options[i])
|
||||
if torrent_magnets:
|
||||
client.core.add_torrent_magnets(torrent_magnets, torrent_magnet_options)
|
||||
for i, m in enumerate(torrent_magnets):
|
||||
client.core.add_torrent_magnet(m, torrent_magnet_options[i])
|
||||
|
||||
client.force_call(False)
|
||||
self.hide()
|
||||
|
|
|
@ -152,7 +152,7 @@ def process_args(args):
|
|||
component.get("AddTorrentDialog").add_from_magnets([arg])
|
||||
component.get("AddTorrentDialog").show(config["focus_add_dialog"])
|
||||
else:
|
||||
client.core.add_torrent_magnets([arg], [])
|
||||
client.core.add_torrent_magnet(arg, {})
|
||||
else:
|
||||
# Just a file
|
||||
log.debug("Attempting to add %s from external source..",
|
||||
|
|
Loading…
Reference in New Issue