mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 23:48:40 +00:00
Allow setting torrent ownership when adding new torrents.
This commit is contained in:
parent
936bd925d9
commit
78e966946f
1 changed files with 6 additions and 2 deletions
|
@ -329,7 +329,8 @@ class TorrentManager(component.Component):
|
||||||
log.warning("Unable to delete the fastresume file: %s", e)
|
log.warning("Unable to delete the fastresume file: %s", e)
|
||||||
|
|
||||||
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
||||||
filedump=None, filename=None, magnet=None, resume_data=None):
|
filedump=None, filename=None, magnet=None, resume_data=None,
|
||||||
|
owner='localclient'):
|
||||||
"""Add a torrent to the manager and returns it's torrent_id"""
|
"""Add a torrent to the manager and returns it's torrent_id"""
|
||||||
|
|
||||||
if torrent_info is None and state is None and filedump is None and magnet is None:
|
if torrent_info is None and state is None and filedump is None and magnet is None:
|
||||||
|
@ -447,7 +448,10 @@ class TorrentManager(component.Component):
|
||||||
# Set auto_managed to False because the torrent is paused
|
# Set auto_managed to False because the torrent is paused
|
||||||
handle.auto_managed(False)
|
handle.auto_managed(False)
|
||||||
# Create a Torrent object
|
# Create a Torrent object
|
||||||
owner = state.owner if state else component.get("RPCServer").get_session_user()
|
owner = state.owner if state else (owner if owner else component.get("RPCServer").get_session_user())
|
||||||
|
account_exists = component.get("AuthManager").has_account(owner)
|
||||||
|
if not account_exists:
|
||||||
|
owner = 'localclient'
|
||||||
torrent = Torrent(handle, options, state, filename, magnet, owner)
|
torrent = Torrent(handle, options, state, filename, magnet, owner)
|
||||||
# Add the torrent object to the dictionary
|
# Add the torrent object to the dictionary
|
||||||
self.torrents[torrent.torrent_id] = torrent
|
self.torrents[torrent.torrent_id] = torrent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue