[Core] Fix torrent pause/resume logic
If the torrent_id argument received in the pause or resume methods is not a string, the methods execute with the un-parsed input and then with parsed input on a second call. A key error exception is thrown from the first call, and the second call succeeds.
This commit is contained in:
parent
f94f58918e
commit
585ea88f1f
|
@ -627,7 +627,8 @@ class Core(component.Component):
|
||||||
log.debug('Pausing: %s', torrent_id)
|
log.debug('Pausing: %s', torrent_id)
|
||||||
if not isinstance(torrent_id, str if not PY2 else basestring):
|
if not isinstance(torrent_id, str if not PY2 else basestring):
|
||||||
self.pause_torrents(torrent_id)
|
self.pause_torrents(torrent_id)
|
||||||
self.torrentmanager[torrent_id].pause()
|
else:
|
||||||
|
self.torrentmanager[torrent_id].pause()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def pause_torrents(self, torrent_ids=None):
|
def pause_torrents(self, torrent_ids=None):
|
||||||
|
@ -677,7 +678,8 @@ class Core(component.Component):
|
||||||
log.debug('Resuming: %s', torrent_id)
|
log.debug('Resuming: %s', torrent_id)
|
||||||
if not isinstance(torrent_id, str if not PY2 else basestring):
|
if not isinstance(torrent_id, str if not PY2 else basestring):
|
||||||
self.resume_torrents(torrent_id)
|
self.resume_torrents(torrent_id)
|
||||||
self.torrentmanager[torrent_id].resume()
|
else:
|
||||||
|
self.torrentmanager[torrent_id].resume()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def resume_torrents(self, torrent_ids=None):
|
def resume_torrents(self, torrent_ids=None):
|
||||||
|
|
Loading…
Reference in New Issue