Sha256: 355232a0958913298d942a2de2376419289cb05c3abdacc85882f96664a6362c
Contents?: true
Size: 852 Bytes
Versions: 4
Compression:
Stored size: 852 Bytes
Contents
# Written by John Hoffman # see LICENSE.txt for license information from binascii import unhexlify try: True except: True = 1 False = 0 # parses a list of torrent hashes, in the format of one hash per line in hex format def parsetorrentlist(filename, parsed): new_parsed = {} added = {} removed = parsed f = open(filename, 'r') while True: l = f.readline() if not l: break l = l.strip() try: if len(l) != 40: raise ValueError, 'bad line' h = unhexlify(l) except: print '*** WARNING *** could not parse line in torrent list: '+l if parsed.has_key(h): del removed[h] else: added[h] = True new_parsed[h] = True f.close() return (new_parsed, added, removed)
Version data entries
4 entries across 4 versions & 1 rubygems