[#1330] [Core] Fix pausing and resuming session
* The paused state of torrents is now correctly stored on shutdown if the session is paused. * Resume session refreshes all the torrents' state. This fixes only torrents that changed state being updated so queued torrents would be incorrectly displayed as paused.
This commit is contained in:
parent
8241b2ba3e
commit
e1548cc974
|
@ -458,6 +458,8 @@ class Core(component.Component):
|
|||
"""Resume all torrents in the session"""
|
||||
if self.session.is_paused():
|
||||
self.session.resume()
|
||||
for torrent_id in self.torrentmanager.torrents:
|
||||
self.torrentmanager[torrent_id].update_state()
|
||||
component.get("EventManager").emit(SessionResumedEvent())
|
||||
|
||||
@export
|
||||
|
|
|
@ -582,9 +582,12 @@ class TorrentManager(component.Component):
|
|||
state = TorrentManagerState()
|
||||
# Create the state for each Torrent and append to the list
|
||||
for torrent in self.torrents.values():
|
||||
paused = False
|
||||
if torrent.state in ["Paused", "Error"]:
|
||||
if self.session.is_paused():
|
||||
paused = torrent.handle.is_paused()
|
||||
elif torrent.state in ["Paused", "Error"]:
|
||||
paused = True
|
||||
else:
|
||||
paused = False
|
||||
|
||||
torrent_state = TorrentState(
|
||||
torrent.torrent_id,
|
||||
|
|
|
@ -107,7 +107,7 @@ class Core(CorePluginBase):
|
|||
for setting in CONTROLLED_SETTINGS:
|
||||
component.get("PreferencesManager").do_config_set_func(setting, core_config[setting])
|
||||
# Resume the session if necessary
|
||||
component.get("Core").session.resume()
|
||||
component.get("Core").resume_session()
|
||||
|
||||
def do_schedule(self, timer=True):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue