Attempt fix fastresume saving issue.

This commit is contained in:
Andrew Resch 2008-02-18 00:50:12 +00:00
parent b59d148a21
commit bff0e3f8d5
2 changed files with 7 additions and 4 deletions

View File

@ -732,8 +732,12 @@ Space:") + " " + nice_free)
if event['event_type'] in self.event_callbacks: if event['event_type'] in self.event_callbacks:
for callback in self.event_callbacks[event['event_type']]: for callback in self.event_callbacks[event['event_type']]:
callback(event) callback(event)
if event['event_type'] is self.constants['EVENT_TORRENT_PAUSED'] or \
event['event_type'] is self.constants['EVENT_FINISHED_CHECKING']:
self.save_fastresume_data(event['unique_ID'])
if event['event_type'] is self.constants['EVENT_FINISHED']: if event['event_type'] is self.constants['EVENT_FINISHED']:
if event['message'] == "torrent has finished downloading": if event['message'] == "torrent has finished downloading":
# Queue seeding torrent to bottom if needed # Queue seeding torrent to bottom if needed

View File

@ -833,7 +833,8 @@ window, please enter your password"))
torrent_state = self.manager.get_torrent_state(uid) torrent_state = self.manager.get_torrent_state(uid)
if torrent_state["is_paused"]: if torrent_state["is_paused"]:
try: try:
os.remove(self.manager.unique_IDs[uid].filename + ".fastresume") if torrent_state["state"] != 6 or torrent_state["state"] != 7:
os.remove(self.manager.unique_IDs[uid].filename + ".fastresume")
except: except:
pass pass
self.manager.set_user_pause(uid, False, True) self.manager.set_user_pause(uid, False, True)
@ -849,8 +850,6 @@ window, please enter your password"))
for uid in unique_ids: for uid in unique_ids:
self.manager.set_user_pause(uid, True, True) self.manager.set_user_pause(uid, True, True)
torrent_state = self.manager.get_torrent_state(uid) torrent_state = self.manager.get_torrent_state(uid)
if torrent_state["is_paused"] == 0:
self.manager.save_fastresume_data(uid)
self.update() self.update()
except: except:
pass pass