欢迎光临
我们一直在努力

修改Deluge2.0.3的User-Agent/PeerID

这Deluge2.x版本都出来这么长时间了,几个批T站还不支持。。我也是佛了。。

现在还辣么早呢,你就说支持Deluge2.x呢,会不会给人感觉就是内定了,是钦点了Deluge2.x呢?

没有,没任何内定钦点的意思。还是要按照批T站的规则,鸡本规则去产生。。。

但是你们能不能。。。

你,刚才问我啊,我可以回答你一句“5可奉告”,那你们又不高兴,那怎么办?

那Deluge2.x。。。

我讲的意思不是我钦点Deluge2.x当新客户端。你问我支持不支持,我说支持。我就明确给你告诉这一点。

Debian9/10安装Deluge2.x可以参考:

Debian9编译安装Deluge2.0.3+Libtorrent1.2.1

只需要改动一个文件,关键就在这个core.py里面,未安装的路径:

/deluge-2.0.3/deluge/core/core.py

Debian10使用libtorrent-rasterbar1.2.1+Python3安装后的路径:

/usr/local/lib/python3.7/dist-packages/deluge-2.0.3-py3.7.egg/deluge/core/core.py

123-124行的:

        user_agent = 'Deluge/{} libtorrent/{}'.format(DELUGE_VER, LT_VERSION)
        peer_id = self._create_peer_id(DELUGE_VER)

改为:

        user_agent = 'Deluge 1.3.15'
        peer_id = '-DE13F0-'

如图所示:

252行的:

    def _create_peer_id(version):
        """Create a peer_id fingerprint.
        This creates the peer_id and modifies the release char to identify
        pre-release and development version. Using ``D`` for dev, daily or
        nightly builds, ``a, b, r`` for pre-releases and ``s`` for
        stable releases.
        Examples:
            ``----``
            ``--DE200D--`` (development version of 2.0.0)
            ``--DE200s--`` (stable release of v2.0.0)
            ``--DE201b--`` (beta pre-release of v2.0.1)
        Args:
            version (str): The version string in PEP440 dotted notation.
        Returns:
            str: The formattted peer_id with Deluge prefix e.g. '--DE200s--'
        """
        split = deluge.common.VersionSplit(version)
        # Fill list with zeros to length of 4 and use lt to create fingerprint.
        version_list = split.version + [0] * (4 - len(split.version))
        peer_id = lt.generate_fingerprint('DE', *version_list)

        def substitute_chr(string, idx, char):
            """Fast substitute single char in string."""
            return string[:idx] + char + string[idx + 1 :]

        if split.dev:
            release_chr = 'D'
        elif split.suffix:
            # a (alpha), b (beta) or r (release candidate).
            release_chr = split.suffix[0].lower()
        else:
            release_chr = 's'
        peer_id = substitute_chr(peer_id, 6, release_chr)

        return peer_id

改为(或者直接删除这个函数):

    def _create_peer_id(version):
        pass

如图所示:

LALA

我什么都不卖了,告辞!

赞(0)
未经允许不得转载:拆东墙 » 修改Deluge2.0.3的User-Agent/PeerID

评论 抢沙发

登录

找回密码

注册