Fix issue where some torrents with special characters could not be added

This commit is contained in:
Andrew Resch 2009-11-19 02:39:07 +00:00
parent 789356d44d
commit aa86aa6fe1
1 changed files with 6 additions and 20 deletions

View File

@ -716,11 +716,6 @@ class AddTorrentDialog(component.Component):
if row is not None: if row is not None:
self.save_torrent_options(row) self.save_torrent_options(row)
torrent_filenames = []
torrent_magnets = []
torrent_magnet_options = []
torrent_options = []
row = self.torrent_liststore.get_iter_first() row = self.torrent_liststore.get_iter_first()
while row != None: while row != None:
torrent_id = self.torrent_liststore.get_value(row, 0) torrent_id = self.torrent_liststore.get_value(row, 0)
@ -735,26 +730,17 @@ class AddTorrentDialog(component.Component):
options["file_priorities"] = file_priorities options["file_priorities"] = file_priorities
if deluge.common.is_magnet(filename): if deluge.common.is_magnet(filename):
torrent_magnets.append(filename)
del options["file_priorities"] del options["file_priorities"]
torrent_magnet_options.append(options) client.core.add_torrent_magnet(filename, options)
else: else:
torrent_filenames.append(filename) from deluge.bencode import bencode
torrent_options.append(options) client.core.add_torrent_file(
os.path.split(filename)[-1],
base64.encodestring(bencode(self.infos[torrent_id])),
options)
row = self.torrent_liststore.iter_next(row) row = self.torrent_liststore.iter_next(row)
if torrent_filenames:
for i, f in enumerate(torrent_filenames):
client.core.add_torrent_file(
os.path.split(f)[-1],
base64.encodestring(open(f, "rb").read()),
torrent_options[i])
if torrent_magnets:
for i, m in enumerate(torrent_magnets):
client.core.add_torrent_magnet(m, torrent_magnet_options[i])
client.force_call(False)
self.hide() self.hide()
def _on_button_apply_clicked(self, widget): def _on_button_apply_clicked(self, widget):