Skip to content

Commit

Permalink
Updates to previous fixes for setting is_finished
Browse files Browse the repository at this point in the history
  • Loading branch information
cas-- committed Feb 29, 2012
1 parent b5b0db6 commit 1f5cfd1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions deluge/core/torrentmanager.py
Expand Up @@ -877,7 +877,7 @@ def on_alert_torrent_finished(self, alert):

component.get("EventManager").emit(TorrentFinishedEvent(torrent_id))

torrent.is_finished = torrent.handle.is_seed()
torrent.is_finished = True
torrent.update_state()

# Only save resume data if it was actually downloaded something. Helps
Expand Down Expand Up @@ -924,7 +924,6 @@ def on_alert_torrent_checked(self, alert):
if torrent.forcing_recheck_paused:
torrent.handle.pause()

torrent.is_finished = torrent.handle.is_seed()
# Set the torrent state
torrent.update_state()

Expand Down Expand Up @@ -1008,6 +1007,11 @@ def on_alert_state_changed(self, alert):

old_state = torrent.state
torrent.update_state()

# Torrent may need to download data after checking.
if torrent.state == 'Checking':
torrent.is_finished = False

# Only emit a state changed event if the state has actually changed
if torrent.state != old_state:
component.get("EventManager").emit(TorrentStateChangedEvent(torrent_id, torrent.state))
Expand Down

0 comments on commit 1f5cfd1

Please sign in to comment.