From a3cef3d06b1069ba7a05fa3951463bc48c492396 Mon Sep 17 00:00:00 2001
From: Christopher Eby <kreed@kreed.org>
Date: Sat, 29 Jun 2013 04:09:58 +0000
Subject: [PATCH] Add get_orig_files() to get filenames without any renaming

---
 deluge/core/torrent.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index bf833f0..24c08cf 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -542,6 +542,22 @@ def get_files(self):
             })
         return ret
 
+    def get_orig_files(self):
+        """Returns a list of the original filenames this torrent contains
+        (before any renaming)"""
+        if not self.has_metadata:
+            return []
+        ret = []
+        files = self.torrent_info.orig_files()
+        for index, file in enumerate(files):
+            ret.append({
+                'index': index,
+                'path': file.path.decode("utf8").replace('\\', '/'),
+                'size': file.size,
+                'offset': file.offset
+            })
+        return ret
+
     def get_peers(self):
         """Returns a list of peers and various information about them"""
         ret = []
@@ -745,6 +761,7 @@ def _create_status_funcs(self):
             "eta":                    self.get_eta,
             "file_progress":          self.get_file_progress, # Adjust progress to be 0-100 value
             "files":                  self.get_files,
+            "orig_files":             self.get_orig_files,
             "is_seed":                self.handle.is_seed,
             "peers":                  self.get_peers,
             "queue":                  self.handle.queue_position,
-- 
1.8.3.1

