fix bug that saved invalid torrents to the state, preventing deluge from starting again.

This commit is contained in:
Zach Tibbitts 2007-03-27 22:44:00 +00:00
parent 6870f0915b
commit 1f3de637b4
2 changed files with 15 additions and 6 deletions

View File

@ -645,9 +645,13 @@ class Manager:
for torrent in self.state.torrents:
if torrent not in torrents_with_unique_ID:
# print "Adding torrent to core:", torrent.filename, torrent.save_dir, torrent.compact
unique_ID = deluge_core.add_torrent(torrent.filename,
try:
unique_ID = deluge_core.add_torrent(torrent.filename,
torrent.save_dir,
torrent.compact)
except InvalidEncodingError, e:
self.state.torrents.remove(torrent)
raise e
# print "Got unique ID:", unique_ID
# Now to check and see if there is enough free space for the download
size = deluge_core.get_torrent_state(unique_ID)["total_size"]

View File

@ -777,13 +777,18 @@ class DelugeGTK:
try:
unique_id = self.manager.add_torrent(torrent, path, self.config.get('use_compact_storage', bool, default=False))
except core.InsufficientFreeSpaceError, err:
nice_need = common.fsize(err.needed_space)
nice_free = common.fsize(err.free_space)
if append:
self.torrent_model.append(self.get_list_from_unique_id(unique_id))
except core.InvalidEncodingError, e:
print "InvalidEncodingError", e
dialogs.show_popup_warning(self.window, _("An error occured while trying to add the torrent. It's possible your .torrent file is corrupted."))
except core.InsufficientFreeSpaceError, e:
nice_need = common.fsize(e.needed_space)
nice_free = common.fsize(e.free_space)
if append:
self.torrent_model.append(self.get_list_from_unique_id(unique_id))