Ticket #2347: 0001-Add-get_orig_files-to-get-filenames-without-any-rena.patch

File 0001-Add-get_orig_files-to-get-filenames-without-any-rena.patch, 1.7 KB (added by Chris Eby, 12 years ago)
  • deluge/core/torrent.py

    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 b def get_files(self):  
    542542            })
    543543        return ret
    544544
     545    def get_orig_files(self):
     546        """Returns a list of the original filenames this torrent contains
     547        (before any renaming)"""
     548        if not self.has_metadata:
     549            return []
     550        ret = []
     551        files = self.torrent_info.orig_files()
     552        for index, file in enumerate(files):
     553            ret.append({
     554                'index': index,
     555                'path': file.path.decode("utf8").replace('\\', '/'),
     556                'size': file.size,
     557                'offset': file.offset
     558            })
     559        return ret
     560
    545561    def get_peers(self):
    546562        """Returns a list of peers and various information about them"""
    547563        ret = []
    def _create_status_funcs(self):  
    745761            "eta":                    self.get_eta,
    746762            "file_progress":          self.get_file_progress, # Adjust progress to be 0-100 value
    747763            "files":                  self.get_files,
     764            "orig_files":             self.get_orig_files,
    748765            "is_seed":                self.handle.is_seed,
    749766            "peers":                  self.get_peers,
    750767            "queue":                  self.handle.queue_position,