Author: andar

Revision: 5940

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

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-11-19 02:29:37 UTC (rev 5939)
+++ branches/1.2_RC/ChangeLog   2009-11-19 02:39:07 UTC (rev 5940)
@@ -11,6 +11,7 @@
        * Fix autoconnecting to the next host in the list if the selected one 
isn't available
        * Fix endless loop when trying to autoconnect to an offline daemon
        * Fix exception on startup when the system tray icon is not enabled
+       * Fix issue where some torrents with special characters could not be 
added
 
 ==== Web ====
        * Fix installing the deluge-web manpage

Modified: branches/1.2_RC/deluge/ui/gtkui/addtorrentdialog.py
===================================================================
--- branches/1.2_RC/deluge/ui/gtkui/addtorrentdialog.py 2009-11-19 02:29:37 UTC 
(rev 5939)
+++ branches/1.2_RC/deluge/ui/gtkui/addtorrentdialog.py 2009-11-19 02:39:07 UTC 
(rev 5940)
@@ -716,11 +716,6 @@
         if row is not None:
             self.save_torrent_options(row)
 
-        torrent_filenames = []
-        torrent_magnets = []
-        torrent_magnet_options = []
-        torrent_options = []
-
         row = self.torrent_liststore.get_iter_first()
         while row != None:
             torrent_id = self.torrent_liststore.get_value(row, 0)
@@ -735,26 +730,17 @@
                 options["file_priorities"] = file_priorities
 
             if deluge.common.is_magnet(filename):
-                torrent_magnets.append(filename)
                 del options["file_priorities"]
-                torrent_magnet_options.append(options)
+                client.core.add_torrent_magnet(filename, options)
             else:
-                torrent_filenames.append(filename)
-                torrent_options.append(options)
+                from deluge.bencode import bencode
+                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)
 
-        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()
 
     def _on_button_apply_clicked(self, widget):

Modified: trunk/deluge/ui/gtkui/addtorrentdialog.py
===================================================================
--- trunk/deluge/ui/gtkui/addtorrentdialog.py   2009-11-19 02:29:37 UTC (rev 
5939)
+++ trunk/deluge/ui/gtkui/addtorrentdialog.py   2009-11-19 02:39:07 UTC (rev 
5940)
@@ -716,11 +716,6 @@
         if row is not None:
             self.save_torrent_options(row)
 
-        torrent_filenames = []
-        torrent_magnets = []
-        torrent_magnet_options = []
-        torrent_options = []
-
         row = self.torrent_liststore.get_iter_first()
         while row != None:
             torrent_id = self.torrent_liststore.get_value(row, 0)
@@ -735,26 +730,17 @@
                 options["file_priorities"] = file_priorities
 
             if deluge.common.is_magnet(filename):
-                torrent_magnets.append(filename)
                 del options["file_priorities"]
-                torrent_magnet_options.append(options)
+                client.core.add_torrent_magnet(filename, options)
             else:
-                torrent_filenames.append(filename)
-                torrent_options.append(options)
+                from deluge.bencode import bencode
+                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)
 
-        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()
 
     def _on_button_apply_clicked(self, widget):


--

You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=.


Reply via email to