From 1e7bf9bd5f2200b74650067361b6fd9cea6097d9 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 9 Jun 2013 23:32:02 +0000 Subject: [PATCH] Show DHT nodes if they are present git-svn-id: file:///home/phd/archive/SVN/mc-extfs/trunk@64 1a6e6372-1aea-0310-bd00-dc960550e1df --- torrent | 10 ++++++++-- torrent-ANNOUNCE | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/torrent b/torrent index 6f1d91f..347df41 100755 --- a/torrent +++ b/torrent @@ -124,7 +124,7 @@ def mctorrent_list(): meta = [] for name in 'announce', 'announce-list', 'codepage', 'comment', \ 'created by', 'creation date', 'encoding', \ - 'publisher', 'publisher-url': + 'nodes', 'publisher', 'publisher-url': 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))) @@ -135,6 +135,9 @@ def mctorrent_list(): data = str(torrent[name]) elif name == 'creation date': data = decode_datetime(torrent[name]) + elif name == 'nodes': + data = ['%s:%s' % (host, port) for host, port in torrent[name]] + data = '\n'.join(data) else: data = torrent[name] meta.append(('.META/' + name, len(data))) @@ -158,7 +161,7 @@ def mctorrent_copyout(): for name in 'announce', 'announce-list', 'codepage', 'comment', \ 'created by', 'creation date', 'encoding', \ - 'publisher', 'publisher-url': + 'nodes', 'publisher', 'publisher-url': 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))) @@ -170,6 +173,9 @@ def mctorrent_copyout(): data = str(torrent[name]) elif name == 'creation date': data = decode_datetime(torrent[name]) + elif name == 'nodes': + data = ['%s:%s' % (host, port) for host, port in torrent[name]] + data = '\n'.join(data) else: data = str(torrent[name]) else: diff --git a/torrent-ANNOUNCE b/torrent-ANNOUNCE index 34f31c4..91de5cd 100644 --- a/torrent-ANNOUNCE +++ b/torrent-ANNOUNCE @@ -7,6 +7,7 @@ Midnight Commander. WHAT'S NEW in version 1.1.0 (2013-06-10) + Show DHT nodes if they are present. Show publisher and publisher-url if they are available. Use name.utf-8, path.utf-8 and comment.utf-8 if those are available. Use codepage instead of encoding if codepage is available -- 2.39.2