From 09d04aaac072e68d6f02ff1b0ca09a777a7e0095 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 16 Nov 2018 12:14:58 +0000 Subject: [PATCH] [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. --- deluge/core/torrent.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index a2b1eb1e6..10e444cb5 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -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}