Author: andar

Revision: 5421

Log:
        Add ability to rename files prior to adding with the option 
"mapped_files" which is a dictionary of {index: filename, ...}

Diff:
Modified: trunk/deluge/core/torrent.py
===================================================================
--- trunk/deluge/core/torrent.py        2009-06-26 18:43:38 UTC (rev 5420)
+++ trunk/deluge/core/torrent.py        2009-06-26 23:31:47 UTC (rev 5421)
@@ -75,6 +75,7 @@
         for opt_k, conf_k in options_conf_map.iteritems():
             self[opt_k] = config[conf_k]
         self["file_priorities"] = []
+        self["mapped_files"] = {}
 
 class Torrent:
     """Torrent holds information about torrents added to the libtorrent 
session.

Modified: trunk/deluge/core/torrentmanager.py
===================================================================
--- trunk/deluge/core/torrentmanager.py 2009-06-26 18:43:38 UTC (rev 5420)
+++ trunk/deluge/core/torrentmanager.py 2009-06-26 23:31:47 UTC (rev 5421)
@@ -340,6 +340,12 @@
                 o.update(options)
                 options = o
 
+            # Check for renamed files and if so, rename them in the 
torrent_info
+            # before adding to the session.
+            if options["mapped_files"]:
+                for index, name in options["mapped_files"].items():
+                    torrent_info.rename_file(index, name)
+
             add_torrent_params["ti"] = torrent_info
             add_torrent_params["resume_data"] = ""
 



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