mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 16:08:40 +00:00
make force-recheck remember trackers and upload memory
This commit is contained in:
parent
cdb6450d48
commit
1d36020f9d
2 changed files with 31 additions and 14 deletions
1
TODO
1
TODO
|
@ -1,4 +1,3 @@
|
||||||
for 0.5.7
|
for 0.5.7
|
||||||
* add queue support and remembering edited trackers and uploaded memory to manual recheck
|
|
||||||
* remap filenames
|
* remap filenames
|
||||||
* decide what to do about the progress bar patch
|
* decide what to do about the progress bar patch
|
||||||
|
|
|
@ -749,32 +749,50 @@ window, please enter your password"))
|
||||||
else:
|
else:
|
||||||
newpath = os.path.join(xdg.BaseDirectory.save_config_path('deluge'), 'tmp')
|
newpath = os.path.join(xdg.BaseDirectory.save_config_path('deluge'), 'tmp')
|
||||||
if not os.path.exists(newpath):
|
if not os.path.exists(newpath):
|
||||||
os.mkdir(newpath)
|
try:
|
||||||
|
os.mkdir(newpath)
|
||||||
|
except:
|
||||||
|
dialogs.show_popup_warning(self.window, _("There was an error\
|
||||||
|
trying to create \"%s\"\nPlease make sure you have the write permissions and then try again.") %newpath)
|
||||||
torrent_state = self.manager.get_torrent_state(uid)
|
torrent_state = self.manager.get_torrent_state(uid)
|
||||||
order = torrent_state['queue_pos']
|
order = torrent_state['queue_pos']
|
||||||
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
|
||||||
(temp, filename_short) = os.path.split(path)
|
(temp, filename_short) = os.path.split(path)
|
||||||
shutil.copy(path, os.path.join(newpath, filename_short))
|
shutil.copy(path, os.path.join(newpath, filename_short))
|
||||||
save_info = [os.path.join(newpath, filename_short), save_dir, order]
|
initial_uploaded_memory = self.manager.unique_IDs[uid].initial_uploaded_memory
|
||||||
self.filepath = os.path.join(newpath, 'saveinfo.txt')
|
uploaded_memory = self.manager.unique_IDs[uid].uploaded_memory
|
||||||
|
save_info = [os.path.join(newpath, filename_short), save_dir, order,\
|
||||||
|
trackerslist, initial_uploaded_memory, uploaded_memory]
|
||||||
try:
|
try:
|
||||||
os.remove(self.manager.unique_IDs[uid].filename + ".fastresume")
|
os.remove(self.manager.unique_IDs[uid].filename + ".fastresume")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
filename = open(self.filepath, 'w')
|
|
||||||
import cPickle
|
|
||||||
cPickle.dump(save_info, filename)
|
|
||||||
filename.close()
|
|
||||||
self.manager.remove_torrent(uid, False, True)
|
self.manager.remove_torrent(uid, False, True)
|
||||||
self.torrent_model_remove(uid)
|
self.torrent_model_remove(uid)
|
||||||
filename = open(self.filepath, 'r')
|
print save_info[0]
|
||||||
save_info = cPickle.load(filename)
|
unique_ID = self.manager.add_torrent(save_info[0], save_info[1], self.config.get("use_compact_storage"))
|
||||||
unique_id = self.manager.add_torrent(save_info[0], save_info[1], self.config.get("use_compact_storage"))
|
self.torrent_model_append(unique_ID)
|
||||||
self.torrent_model_append(unique_id)
|
if save_info[4]:
|
||||||
os.remove(self.filepath)
|
self.manager.unique_IDs[unique_ID].uploaded_memory = \
|
||||||
|
save_info[4]
|
||||||
|
if save_info[5]:
|
||||||
|
self.manager.unique_IDs[unique_ID].initial_uploaded_memory = \
|
||||||
|
save_info[5]
|
||||||
|
if save_info[3]:
|
||||||
|
try:
|
||||||
|
self.manager.replace_trackers(unique_ID, save_info[3])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
torrent_state = self.manager.get_torrent_state(unique_ID)
|
||||||
|
current_order = torrent_state['queue_pos']
|
||||||
|
while current_order != save_info[2]:
|
||||||
|
if current_order > save_info[2]:
|
||||||
|
self.manager.queue_up(unique_ID)
|
||||||
|
else:
|
||||||
|
self.manager.queue_down(unique_ID)
|
||||||
os.remove(save_info[0])
|
os.remove(save_info[0])
|
||||||
filename.close()
|
|
||||||
|
|
||||||
def tor_start(self, widget):
|
def tor_start(self, widget):
|
||||||
unique_ids = self.get_selected_torrent_rows()
|
unique_ids = self.get_selected_torrent_rows()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue