Update the use of add_torrent()
This commit is contained in:
parent
df459e7eaa
commit
9313975ba5
|
@ -257,13 +257,20 @@ class TorrentManager(component.Component):
|
||||||
# We need to pause the AlertManager momentarily to prevent alerts
|
# We need to pause the AlertManager momentarily to prevent alerts
|
||||||
# for this torrent being generated before a Torrent object is created.
|
# for this torrent being generated before a Torrent object is created.
|
||||||
component.pause("AlertManager")
|
component.pause("AlertManager")
|
||||||
|
|
||||||
|
# Create the torrent parameters struct for the torrent's options
|
||||||
|
t_params = {}
|
||||||
|
|
||||||
|
t_params["ti"] = lt.torrent_info(filedump)
|
||||||
|
t_params["save_path"] = str(options["download_location"])
|
||||||
|
t_params["resume_data"] = fastresume
|
||||||
|
t_params["storage_mode"] = storage_mode
|
||||||
|
t_params["paused"] = True
|
||||||
|
t_params["auto_managed"] = False
|
||||||
|
t_params["duplicate_is_error"] = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
handle = self.session.add_torrent(
|
handle = self.session.add_torrent(t_params)
|
||||||
lt.torrent_info(filedump),
|
|
||||||
str(options["download_location"]),
|
|
||||||
resume_data=fastresume,
|
|
||||||
storage_mode=storage_mode,
|
|
||||||
paused=True)
|
|
||||||
except RuntimeError, e:
|
except RuntimeError, e:
|
||||||
log.warning("Error adding torrent: %s", e)
|
log.warning("Error adding torrent: %s", e)
|
||||||
|
|
||||||
|
@ -443,12 +450,19 @@ class TorrentManager(component.Component):
|
||||||
storage_mode = lt.storage_mode_t(1)
|
storage_mode = lt.storage_mode_t(1)
|
||||||
|
|
||||||
# Add the torrent to the lt session
|
# Add the torrent to the lt session
|
||||||
|
|
||||||
|
# Create the torrent parameters struct for the torrent's options
|
||||||
|
t_params = lt.add_torrent_params()
|
||||||
|
|
||||||
|
t_params.ti = lt.torrent_info(torrent_info)
|
||||||
|
t_params.save_path = str(torrent.save_path)
|
||||||
|
t_params.storage_mode = storage_mode
|
||||||
|
t_params.paused = paused
|
||||||
|
t_params.auto_managed = False
|
||||||
|
t_params.duplicate_is_error = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
torrent.handle = self.session.add_torrent(
|
handle = self.session.add_torrent(t_params)
|
||||||
lt.torrent_info(torrent_info),
|
|
||||||
str(torrent.save_path),
|
|
||||||
storage_mode=storage_mode,
|
|
||||||
paused=paused)
|
|
||||||
except RuntimeError, e:
|
except RuntimeError, e:
|
||||||
log.warning("Error adding torrent: %s", e)
|
log.warning("Error adding torrent: %s", e)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue