H...
Content-type: text/plain

Author: andar

Revision: 5449

Log:
        Change add_torrent_magnets to add_torrent_magnet
Have add_torrent_magnet return a torrent_id on successful add

Diff:
Modified: trunk/deluge/core/core.py
===================================================================
--- trunk/deluge/core/core.py   2009-07-04 23:59:38 UTC (rev 5448)
+++ trunk/deluge/core/core.py   2009-07-05 00:09:49 UTC (rev 5449)
@@ -293,16 +293,18 @@
         return d
 
     @export
-    def add_torrent_magnets(self, uris, options):
-        for uri in uris:
-            log.debug("Attempting to add by magnet uri: %s", uri)
-            try:
-                option = options[uris.index(uri)]
-            except IndexError:
-                option = None
+    def add_torrent_magnet(self, uri, options):
+        """
+        Adds a torrent from a magnet link.
 
-            torrent_id = self.torrentmanager.add(magnet=uri, options=option)
+        :param uri: str, the magnet link
+        :param options: dict, the options to apply to the torrent on add
 
+        """
+        log.debug("Attempting to add by magnet uri: %s", uri)
+
+        return self.torrentmanager.add(magnet=uri, options=options)
+
     @export
     def remove_torrent(self, torrent_ids, remove_data):
         log.debug("Removing torrent %s from the core.", torrent_ids)

Modified: trunk/deluge/ui/gtkui/addtorrentdialog.py
===================================================================
--- trunk/deluge/ui/gtkui/addtorrentdialog.py   2009-07-04 23:59:38 UTC (rev 
5448)
+++ trunk/deluge/ui/gtkui/addtorrentdialog.py   2009-07-05 00:09:49 UTC (rev 
5449)
@@ -751,7 +751,8 @@
                     base64.encodestring(open(f, "rb").read()),
                     torrent_options[i])
         if torrent_magnets:
-            client.core.add_torrent_magnets(torrent_magnets, 
torrent_magnet_options)
+            for i, m in enumerate(torrent_magnets):
+                client.core.add_torrent_magnet(m, torrent_magnet_options[i])
 
         client.force_call(False)
         self.hide()

Modified: trunk/deluge/ui/gtkui/ipcinterface.py
===================================================================
--- trunk/deluge/ui/gtkui/ipcinterface.py       2009-07-04 23:59:38 UTC (rev 
5448)
+++ trunk/deluge/ui/gtkui/ipcinterface.py       2009-07-05 00:09:49 UTC (rev 
5449)
@@ -152,7 +152,7 @@
                 component.get("AddTorrentDialog").add_from_magnets([arg])
                 
component.get("AddTorrentDialog").show(config["focus_add_dialog"])
             else:
-                client.core.add_torrent_magnets([arg], [])
+                client.core.add_torrent_magnet(arg, {})
         else:
             # Just a file
             log.debug("Attempting to add %s from external source..",



--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to