diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2017-02-14 19:29:33 +0000 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2017-02-23 00:21:33 +0000 |
commit | 9ad2f50fa44dbc1ed35ee839c3b7921b7e10c570 (patch) | |
tree | cdd1114b9cdedd72decb219274b3d206c0fee880 /deluge/ui/common.py | |
parent | bbd2661acb88148bf459e71509c230604823635c (diff) | |
download | deluge-9ad2f50fa44dbc1ed35ee839c3b7921b7e10c570.tar.gz deluge-9ad2f50fa44dbc1ed35ee839c3b7921b7e10c570.tar.bz2 deluge-9ad2f50fa44dbc1ed35ee839c3b7921b7e10c570.zip |
[Common] Decode byte strings for TorrentInfo
Diffstat (limited to 'deluge/ui/common.py')
-rw-r--r-- | deluge/ui/common.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/deluge/ui/common.py b/deluge/ui/common.py index a8a872671..6b7e812b2 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -20,7 +20,7 @@ from hashlib import sha1 as sha import deluge.configmanager from deluge import bencode -from deluge.common import utf8_encoded +from deluge.common import decode_string log = logging.getLogger(__name__) @@ -166,9 +166,9 @@ class TorrentInfo(object): # Check if 'name.utf-8' is in the torrent and if not try to decode the string # using the encoding found. if 'name.utf-8' in self.__m_metadata['info']: - self.__m_name = utf8_encoded(self.__m_metadata['info']['name.utf-8']) + self.__m_name = decode_string(self.__m_metadata['info']['name.utf-8']) else: - self.__m_name = utf8_encoded(self.__m_metadata['info']['name'], self.encoding) + self.__m_name = decode_string(self.__m_metadata['info']['name'], self.encoding) # Get list of files from torrent info paths = {} @@ -180,11 +180,10 @@ class TorrentInfo(object): for index, f in enumerate(self.__m_metadata['info']['files']): if 'path.utf-8' in f: - path = os.path.join(prefix, *f['path.utf-8']) + path = decode_string(os.path.join(prefix, *f['path.utf-8'])) del f['path.utf-8'] else: - path = utf8_encoded(os.path.join(prefix, utf8_encoded(os.path.join(*f['path']), - self.encoding)), self.encoding) + path = os.path.join(prefix, decode_string(os.path.join(*f['path']), self.encoding)) f['path'] = path f['index'] = index if 'sha1' in f and len(f['sha1']) == 20: |