コード例 #1
0
    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
コード例 #2
0
ファイル: TorrentDef.py プロジェクト: nomadsummer/cs198mojo
    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
コード例 #3
0
ファイル: TorrentDef.py プロジェクト: nomadsummer/cs198mojo
    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
コード例 #4
0
ファイル: TorrentDef.py プロジェクト: Antiade/tribler
    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
コード例 #5
0
ファイル: TorrentDef.py プロジェクト: Anaconda84/Anaconda
    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
コード例 #6
0
ファイル: TorrentDef.py プロジェクト: yorig/tribler
    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
コード例 #7
0
ファイル: TorrentDef.py プロジェクト: egbertbouman/tribler-g
    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