Ensure is_finished value is correct after state changed alert

Set torrent.is_finished to false when torrent is in a Checking or Downloading state
This commit is contained in:
Calum Lind 2012-02-29 02:56:01 +00:00
parent 7ae912114b
commit 2ecb54c4f7
1 changed files with 5 additions and 0 deletions

View File

@ -1064,6 +1064,11 @@ class TorrentManager(component.Component):
old_state = torrent.state old_state = torrent.state
torrent.update_state() torrent.update_state()
# Torrent may need to download data after checking.
if torrent.state in ('Checking', 'Checking Resume Data', 'Downloading'):
torrent.is_finished = False
# Only emit a state changed event if the state has actually changed # Only emit a state changed event if the state has actually changed
if torrent.state != old_state: if torrent.state != old_state:
component.get("EventManager").emit(TorrentStateChangedEvent(torrent_id, torrent.state)) component.get("EventManager").emit(TorrentStateChangedEvent(torrent_id, torrent.state))