[Core] Use new lt torrent moving_storage status

This commit is contained in:
Calum Lind 2017-01-13 14:29:58 +00:00
parent 93898d6475
commit 5d7c1336b9
2 changed files with 2 additions and 6 deletions

View File

@ -246,7 +246,6 @@ class Torrent(object):
self.forced_error = None self.forced_error = None
self.statusmsg = None self.statusmsg = None
self.state = None self.state = None
self.moving_storage = False
self.moving_storage_dest_path = None self.moving_storage_dest_path = None
self.tracker_status = '' self.tracker_status = ''
self.tracker_host = None self.tracker_host = None
@ -614,7 +613,7 @@ class Torrent(object):
# auto-manage status will be reverted upon resuming. # auto-manage status will be reverted upon resuming.
self.handle.auto_managed(False) self.handle.auto_managed(False)
self.set_status_message(decode_string(status_error)) self.set_status_message(decode_string(status_error))
elif self.moving_storage: elif status.moving_storage:
self.state = 'Moving' self.state = 'Moving'
elif not session_paused and status.paused and status.auto_managed: elif not session_paused and status.paused and status.auto_managed:
self.state = 'Queued' self.state = 'Queued'
@ -881,7 +880,7 @@ class Torrent(object):
if self.state == 'Error': if self.state == 'Error':
progress = 100.0 progress = 100.0
elif self.moving_storage: elif self.state == 'Moving':
# Check if torrent has downloaded any data yet. # Check if torrent has downloaded any data yet.
if self.status.total_done: if self.status.total_done:
torrent_files = [f['path'] for f in self.get_files()] torrent_files = [f['path'] for f in self.get_files()]
@ -1125,7 +1124,6 @@ class Torrent(object):
except RuntimeError as ex: except RuntimeError as ex:
log.error('Error calling libtorrent move_storage: %s', ex) log.error('Error calling libtorrent move_storage: %s', ex)
return False return False
self.moving_storage = True
self.moving_storage_dest_path = dest self.moving_storage_dest_path = dest
self.update_state() self.update_state()
return True return True

View File

@ -1062,7 +1062,6 @@ class TorrentManager(component.Component):
torrent.set_download_location(os.path.normpath(alert.storage_path)) torrent.set_download_location(os.path.normpath(alert.storage_path))
torrent.set_move_completed(False) torrent.set_move_completed(False)
torrent.moving_storage = False
torrent.update_state() torrent.update_state()
if torrent_id in self.waiting_on_finish_moving: if torrent_id in self.waiting_on_finish_moving:
@ -1081,7 +1080,6 @@ class TorrentManager(component.Component):
log.warning('on_alert_storage_moved_failed: %s', decode_string(alert.message())) log.warning('on_alert_storage_moved_failed: %s', decode_string(alert.message()))
# Set an Error message and pause the torrent # Set an Error message and pause the torrent
alert_msg = decode_string(alert.message()).split(':', 1)[1].strip() alert_msg = decode_string(alert.message()).split(':', 1)[1].strip()
torrent.moving_storage = False
torrent.force_error_state('Failed to move download folder: %s' % alert_msg) torrent.force_error_state('Failed to move download folder: %s' % alert_msg)
if torrent_id in self.waiting_on_finish_moving: if torrent_id in self.waiting_on_finish_moving: