[Core] Fix showing incorrect file priorities

Removed previous workaround to ensure sync of file priorities with
libtorrent. This did not work when loading torrents as the status is
called before setting the file priorites and resets them to default.

Removed the call to set_file_priorities when writing the torrent file
to disk as it resets the options to default so although the torrent
file priorities do not change, the priorities for UIs is incorrect.
This commit is contained in:
Calum Lind 2018-11-16 12:14:58 +00:00
parent 27b4e2d891
commit 09d04aaac0
1 changed files with 1 additions and 6 deletions

View File

@ -1029,10 +1029,6 @@ class Torrent(object):
status (libtorrent.torrent_status): a libtorrent torrent status
"""
self.status = status
# Ensure that the file_priorities are kept in sync with libtorrent.
# We do this here as file_priorities is async and can't call it
# immediately after setting priorities.
self.options['file_priorities'] = self.handle.file_priorities()
def _create_status_funcs(self):
"""Creates the functions for getting torrent status"""
@ -1297,8 +1293,7 @@ class Torrent(object):
log.error('Unable to save torrent file to: %s', ex)
filepath = os.path.join(get_config_dir(), 'state', self.torrent_id + '.torrent')
# Regenerate the file priorities
self.set_file_priorities([])
if filedump is None:
metadata = lt.bdecode(self.torrent_info.metadata())
torrent_file = {b'info': metadata}