r230 - /debtorrent/branches/unique/btshowmetainfo.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Mon Aug 13 19:37:34 UTC 2007


Author: camrdale-guest
Date: Mon Aug 13 19:37:34 2007
New Revision: 230

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=230
Log:
Hexify btshowmetainfo's printing of the new identifier field.

Modified:
    debtorrent/branches/unique/btshowmetainfo.py

Modified: debtorrent/branches/unique/btshowmetainfo.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/branches/unique/btshowmetainfo.py?rev=230&op=diff
==============================================================================
--- debtorrent/branches/unique/btshowmetainfo.py (original)
+++ debtorrent/branches/unique/btshowmetainfo.py Mon Aug 13 19:37:34 2007
@@ -12,6 +12,7 @@
 from sys import *
 from os.path import *
 from sha import *
+from binascii import b2a_hex
 from DebTorrent.bencode import *
 from DebTorrent.download_bt1 import get_packages
 
@@ -36,9 +37,12 @@
 #    print metainfo
     info = metainfo['info']
     info_hash = sha(bencode(info)).hexdigest()
+    identifier = b2a_hex(metainfo.get('identifier', ''))
+    if not identifier:
+        identifier = info_hash
 
     print 'metainfo file.: %s' % basename(metainfo_name)
-    print 'identifier....: %s' % metainfo.get("identifier", info_hash)
+    print 'identifier....: %s' % identifier
     print 'info hash.....: %s' % info_hash
     piece_lengths = info['piece lengths']
     print 'directory name: %s' % metainfo['name']




More information about the Debtorrent-commits mailing list