Author: johnnyg

Revision: 5892

Log:
        Make sure renamed files are utf-8 encoded.

Diff:
Modified: branches/1.2_RC/deluge/core/torrent.py
===================================================================
--- branches/1.2_RC/deluge/core/torrent.py      2009-10-29 06:02:20 UTC (rev 
5891)
+++ branches/1.2_RC/deluge/core/torrent.py      2009-10-30 00:02:25 UTC (rev 
5892)
@@ -816,7 +816,7 @@
         """Renames files in the torrent. 'filenames' should be a list of
         (index, filename) pairs."""
         for index, filename in filenames:
-            self.handle.rename_file(index, filename)
+            self.handle.rename_file(index, filename.encode("utf-8"))
 
     def rename_folder(self, folder, new_folder):
         """Renames a folder within a torrent.  This basically does a file 
rename
@@ -834,5 +834,5 @@
             if f["path"].startswith(folder):
                 # Keep a list of filerenames we're waiting on
                 wait_on_folder[2].append(f["index"])
-                self.handle.rename_file(f["index"], f["path"].replace(folder, 
new_folder, 1))
+                self.handle.rename_file(f["index"], f["path"].replace(folder, 
new_folder, 1).encode("utf-8"))
         self.waiting_on_folder_rename.append(wait_on_folder)

Modified: branches/1.2_RC/deluge/core/torrentmanager.py
===================================================================
--- branches/1.2_RC/deluge/core/torrentmanager.py       2009-10-29 06:02:20 UTC 
(rev 5891)
+++ branches/1.2_RC/deluge/core/torrentmanager.py       2009-10-30 00:02:25 UTC 
(rev 5892)
@@ -381,7 +381,7 @@
             if options["mapped_files"]:
                 for index, name in options["mapped_files"].items():
                     log.debug("renaming file index %s to %s", index, name)
-                    torrent_info.rename_file(index, name)
+                    torrent_info.rename_file(index, name.encode("utf-8"))
 
             add_torrent_params["ti"] = torrent_info
             add_torrent_params["resume_data"] = ""

Modified: trunk/deluge/core/torrent.py
===================================================================
--- trunk/deluge/core/torrent.py        2009-10-29 06:02:20 UTC (rev 5891)
+++ trunk/deluge/core/torrent.py        2009-10-30 00:02:25 UTC (rev 5892)
@@ -816,7 +816,7 @@
         """Renames files in the torrent. 'filenames' should be a list of
         (index, filename) pairs."""
         for index, filename in filenames:
-            self.handle.rename_file(index, filename)
+            self.handle.rename_file(index, filename.encode("utf-8"))
 
     def rename_folder(self, folder, new_folder):
         """Renames a folder within a torrent.  This basically does a file 
rename
@@ -834,5 +834,5 @@
             if f["path"].startswith(folder):
                 # Keep a list of filerenames we're waiting on
                 wait_on_folder[2].append(f["index"])
-                self.handle.rename_file(f["index"], f["path"].replace(folder, 
new_folder, 1))
+                self.handle.rename_file(f["index"], f["path"].replace(folder, 
new_folder, 1).encode("utf-8"))
         self.waiting_on_folder_rename.append(wait_on_folder)

Modified: trunk/deluge/core/torrentmanager.py
===================================================================
--- trunk/deluge/core/torrentmanager.py 2009-10-29 06:02:20 UTC (rev 5891)
+++ trunk/deluge/core/torrentmanager.py 2009-10-30 00:02:25 UTC (rev 5892)
@@ -381,7 +381,7 @@
             if options["mapped_files"]:
                 for index, name in options["mapped_files"].items():
                     log.debug("renaming file index %s to %s", index, name)
-                    torrent_info.rename_file(index, name)
+                    torrent_info.rename_file(index, name.encode("utf-8"))
 
             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