deal with blank trackers in force recheck and between sessions

This commit is contained in:
Marcos Pinto 2007-11-16 20:56:50 +00:00
parent 5a90e14794
commit b764486bff
2 changed files with 9 additions and 3 deletions

View File

@ -169,6 +169,7 @@ class torrent_info:
self.webseed_urls = [] self.webseed_urls = []
self.desired_ratio = 1.0 self.desired_ratio = 1.0
self.trackers = "" self.trackers = ""
self.trackers_changed = 0
self.delete_me = False # set this to true, to delete it on next sync self.delete_me = False # set this to true, to delete it on next sync
self.del_data = False # set this to true, to delete data on next sync self.del_data = False # set this to true, to delete data on next sync
@ -1017,6 +1018,7 @@ of HD space! Oops!\nWe had to pause at least one torrent"))
def replace_trackers(self, unique_ID, trackerslist): def replace_trackers(self, unique_ID, trackerslist):
self.unique_IDs[unique_ID].trackers = trackerslist self.unique_IDs[unique_ID].trackers = trackerslist
self.unique_IDs[unique_ID].trackers_changed = 1
try: try:
return deluge_core.replace_trackers(unique_ID, trackerslist) return deluge_core.replace_trackers(unique_ID, trackerslist)
except: except:

View File

@ -170,7 +170,7 @@ class DelugeGTK:
self.manager.unique_IDs[unique_ID].initial_uploaded_memory = \ self.manager.unique_IDs[unique_ID].initial_uploaded_memory = \
self.manager.unique_IDs[unique_ID].uploaded_memory self.manager.unique_IDs[unique_ID].uploaded_memory
try: try:
if self.manager.unique_IDs[unique_ID].trackers: if self.manager.unique_IDs[unique_ID].trackers_changed:
try: try:
self.manager.replace_trackers(unique_ID, \ self.manager.replace_trackers(unique_ID, \
self.manager.unique_IDs[unique_ID].trackers) self.manager.unique_IDs[unique_ID].trackers)
@ -747,11 +747,15 @@ window, please enter your password"))
path = self.manager.unique_IDs[uid].filename path = self.manager.unique_IDs[uid].filename
save_dir = self.manager.unique_IDs[uid].save_dir save_dir = self.manager.unique_IDs[uid].save_dir
trackerslist = self.manager.unique_IDs[uid].trackers trackerslist = self.manager.unique_IDs[uid].trackers
try:
trackers_changed = self.manager.unique_IDs[uid].trackers_changed
except AttributeError:
trackers_changed = 0
self.manager.save_upmem() self.manager.save_upmem()
uploaded_memory = self.manager.unique_IDs[uid].uploaded_memory uploaded_memory = self.manager.unique_IDs[uid].uploaded_memory
priorities = self.manager.get_priorities(uid) priorities = self.manager.get_priorities(uid)
save_info = [path, save_dir, order, trackerslist, \ save_info = [path, save_dir, order, trackerslist, \
uploaded_memory, priorities] uploaded_memory, priorities, trackers_changed]
try: try:
os.remove(self.manager.unique_IDs[uid].filename + ".fastresume") os.remove(self.manager.unique_IDs[uid].filename + ".fastresume")
except: except:
@ -768,7 +772,7 @@ window, please enter your password"))
self.manager.unique_IDs[unique_ID].initial_uploaded_memory = \ self.manager.unique_IDs[unique_ID].initial_uploaded_memory = \
save_info[4] save_info[4]
self.manager.save_upmem() self.manager.save_upmem()
if save_info[3]: if save_info[5]:
try: try:
self.manager.replace_trackers(unique_ID, save_info[3]) self.manager.replace_trackers(unique_ID, save_info[3])
except: except: