From bda78424afb794c8ed4ac9b74c7f8639c8be3226 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 9 Jun 2013 22:30:50 +0000 Subject: [PATCH] Use comment.utf-8 if available git-svn-id: file:///home/phd/archive/SVN/mc-extfs/trunk@62 1a6e6372-1aea-0310-bd00-dc960550e1df --- torrent | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/torrent b/torrent index 769d90c..cfc1caa 100755 --- a/torrent +++ b/torrent @@ -124,7 +124,10 @@ def mctorrent_list(): meta = [] for name in 'announce', 'announce-list', 'codepage', 'comment', \ 'created by', 'creation date', 'encoding': - if name in torrent: + if name == 'comment' and 'comment.utf-8' in torrent: + data = torrent['comment.utf-8'].decode('utf-8').encode(charset, 'replace') + meta.append(('.META/' + name, len(data))) + elif name in torrent: if name == 'announce-list': data = decode_announce_list(torrent[name]) elif name == 'codepage': @@ -154,7 +157,10 @@ def mctorrent_copyout(): for name in 'announce', 'announce-list', 'codepage', 'comment', \ 'created by', 'creation date', 'encoding': - if torrent_filename == '.META/' + name: + if name == 'comment' and 'comment.utf-8' in torrent: + data = torrent['comment.utf-8'].decode('utf-8').encode(charset, 'replace') + meta.append(('.META/' + name, len(data))) + elif torrent_filename == '.META/' + name: if name in torrent: if name == 'announce-list': data = decode_announce_list(torrent[name]) -- 2.39.5