def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo, t.input) # For testing EXISTING LIVE, or EXISTING MERKLE: DISABLE, i.e. keep true infohash if t.get_url_compat(): t.infohash = makeurl.metainfo2swarmid(t.metainfo) else: # Two places where infohash calculated, here and in maketorrent.py # Elsewhere: must use TorrentDef.get_infohash() to allow P2PURLs. t.infohash = sha(bencode(metainfo['info'])).digest() assert isinstance( t.infohash, str), "INFOHASH has invalid type: %s" % type(t.infohash) assert len( t.infohash ) == INFOHASH_LENGTH, "INFOHASH has invalid length: %d" % len( t.infohash) #print >>sys.stderr,"INFOHASH",`t.infohash` return t
def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True t.infohash = sha.sha(bencode(metainfo['info'])).digest() # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo,t.input) return t
def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True t.infohash = sha.sha(bencode(metainfo['info'])).digest() # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo, t.input) return t
def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo, t.input) # Two places where infohash calculated, here and in maketorrent.py # Elsewhere: must use TorrentDef.get_infohash() to allow P2PURLs. t.infohash = sha1(bencode(metainfo['info'])).digest() assert isinstance(t.infohash, str), "INFOHASH has invalid type: %s" % type(t.infohash) assert len(t.infohash) == INFOHASH_LENGTH, "INFOHASH has invalid length: %d" % len(t.infohash) return t
def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo, t.input) # For testing EXISTING LIVE, or EXISTING MERKLE: DISABLE, i.e. keep true infohash if t.get_url_compat(): t.infohash = makeurl.metainfo2swarmid(t.metainfo) else: # Two places where infohash calculated, here and in maketorrent.py # Elsewhere: must use TorrentDef.get_infohash() to allow P2PURLs. t.infohash = sha(bencode(metainfo["info"])).digest() # print >>sys.stderr,time.asctime(),'-', "INFOHASH",`t.infohash` return t
def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo, t.input) # Two places where infohash calculated, here and in maketorrent.py # Elsewhere: must use TorrentDef.get_infohash() to allow P2PURLs. t.infohash = sha1(bencode(metainfo['info'])).digest() assert isinstance( t.infohash, str), "INFOHASH has invalid type: %s" % type(t.infohash) assert len( t.infohash ) == INFOHASH_LENGTH, "INFOHASH has invalid length: %d" % len( t.infohash) return t
def _create(metainfo): # TODO: replace with constructor # raises ValueErrors if not good validTorrentFile(metainfo) t = TorrentDef() t.metainfo = metainfo t.metainfo_valid = True # copy stuff into self.input maketorrent.copy_metainfo_to_input(t.metainfo,t.input) # For testing EXISTING LIVE, or EXISTING MERKLE: DISABLE, i.e. keep true infohash if t.get_url_compat(): t.infohash = makeurl.metainfo2swarmid(t.metainfo) else: # Two places where infohash calculated, here and in maketorrent.py # Elsewhere: must use TorrentDef.get_infohash() to allow P2PURLs. t.infohash = sha(bencode(metainfo['info'])).digest() assert isinstance(t.infohash, str), "INFOHASH has invalid type: %s" % type(t.infohash) assert len(t.infohash) == INFOHASH_LENGTH, "INFOHASH has invalid length: %d" % len(t.infohash) #print >>sys.stderr,"INFOHASH",`t.infohash` return t