一个可以自动生成PTGen,MediaInfo,截图,并且生成发布所需内容的脚本

Overview

Differential 差速器

一个可以自动生成PTGen,MediaInfo,截图,并且生成发种所需内容的脚本

为什么叫差速器

差速器是汽车上的一种能使左、右轮胎以不同转速转动的结构。使用同样的动力输入,差速器能够输出不同的转速。就如同这个工具之于PT资源,差速器帮你使用同一份资源,输出不同PT站点需要的发种数据。

差速器能做什么?

当把大部分配置填好时,你可以仅提供资源文件的路径和一个豆瓣链接,差速器会帮你生成发种所需要的影片信息,Mediainfo,截图并上传图床,nfo文件,种子文件,并自动填写发种页面的表单( 感谢树大的脚本

如何安装差速器

Linux

# 安装ffmpeg和mediainfo
sudo apt install ffmpeg mediainfo
pip3 install Differential

Windows

安装下载并安装Python和ffmpeg,然后把ffmpeg放到Path或者你的工作目录,确认在你的工作目录ffmpeg.exe -version有正确输出。

pip.exe install Differential

Mac OS

# 安装ffmpeg
brew install ffmpeg
pip install Differential

如何使用差速器

差速器支持未经过重大修改的NexusPHP站点以及部分支持easy-upload支持的站点。 在使用前,请先使用dft -h查看本工具支持的站点/现有的插件。

请先参考config.ini.example,在Default块填上各个站点/插件通用的参数,比如图床相关的几个参数,然后在各站点/插件名字对应的块填上各自特有的参数,比如截图张数等等。

当配置文件完成后,你可以通过以下命令,一键获取发种所需要的信息。当然你也可以选择通过命令行来传递所有参数。

dft [插件名字] -f [种子文件夹] -u [豆瓣URL]

主要参数介绍:

  • config: 配置文件的位置,默认读取当前文件夹下的config.ini
  • log: log文件的路径
  • folder: 种子文件或文件夹的路径
  • url: 影片的豆瓣链接,事实上,所有PTGen支持的链接这里都支持
  • make_torrent: 是否制种,默认关闭
  • geenrate_nfo: 是否利用mediainfo生成nfo文件,默认关闭
  • screenshot_count: 截图生成的张数,默认为0,即不生成截图
  • image_hosting: 图床的名称,现在支持ptpimg,chevereto,imgurl和SM.MS
  • image_hosting_url: 如果是自建的图床,提供图床链接
  • ptgen_url: PTGen的地址,默认是我自建的PTGen,可能会不稳定
  • announce_url: 制种时的announce地址

NexusPHP

相比基础参数,NexusPHP插件特有的参数有:

  • upload_url: 发种页面的地址
  • encoder_log: 压制log的地址,如果提供的话会在介绍的mediainfo部分附上压制log
  • easy_upload: 默认开启,关闭的话会直接在命令行输出主/副标题,描述和mediainfo
  • trim_description: 默认关闭,开启的话会省略掉上传链接的描述部分,以避免链接过长浏览器无法打开的问题

其他插件

为保护站点信息,请到plugins文件夹查看或者dft [插件名称] -h查看支持的参数

TODO

  • [] 更好的出错管理
  • 识别已经生成过的截图,不重复截图
You might also like...
Comments
  • Bump pillow from 9.0.0 to 9.0.1

    Bump pillow from 9.0.0 to 9.0.1

    Bumps pillow from 9.0.0 to 9.0.1.

    Release notes

    Sourced from pillow's releases.

    9.0.1

    https://pillow.readthedocs.io/en/stable/releasenotes/9.0.1.html

    Changes

    • In show_file, use os.remove to remove temporary images. CVE-2022-24303 #6010 [@​radarhere, @​hugovk]
    • Restrict builtins within lambdas for ImageMath.eval. CVE-2022-22817 #6009 [radarhere]
    Changelog

    Sourced from pillow's changelog.

    9.0.1 (2022-02-03)

    • In show_file, use os.remove to remove temporary images. CVE-2022-24303 #6010 [radarhere, hugovk]

    • Restrict builtins within lambdas for ImageMath.eval. CVE-2022-22817 #6009 [radarhere]

    Commits
    • 6deac9e 9.0.1 version bump
    • c04d812 Update CHANGES.rst [ci skip]
    • 4fabec3 Added release notes for 9.0.1
    • 02affaa Added delay after opening image with xdg-open
    • ca0b585 Updated formatting
    • 427221e In show_file, use os.remove to remove temporary images
    • c930be0 Restrict builtins within lambdas for ImageMath.eval
    • 75b69dd Dont need to pin for GHA
    • cd938a7 Autolink CWE numbers with sphinx-issues
    • 2e9c461 Add CVE IDs
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump pillow from 8.3.2 to 9.0.0

    Bump pillow from 8.3.2 to 9.0.0

    Bumps pillow from 8.3.2 to 9.0.0.

    Release notes

    Sourced from pillow's releases.

    9.0.0

    https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html

    Changes

    ... (truncated)

    Changelog

    Sourced from pillow's changelog.

    9.0.0 (2022-01-02)

    • Restrict builtins for ImageMath.eval(). CVE-2022-22817 #5923 [radarhere]

    • Ensure JpegImagePlugin stops at the end of a truncated file #5921 [radarhere]

    • Fixed ImagePath.Path array handling. CVE-2022-22815, CVE-2022-22816 #5920 [radarhere]

    • Remove consecutive duplicate tiles that only differ by their offset #5919 [radarhere]

    • Improved I;16 operations on big endian #5901 [radarhere]

    • Limit quantized palette to number of colors #5879 [radarhere]

    • Fixed palette index for zeroed color in FASTOCTREE quantize #5869 [radarhere]

    • When saving RGBA to GIF, make use of first transparent palette entry #5859 [radarhere]

    • Pass SAMPLEFORMAT to libtiff #5848 [radarhere]

    • Added rounding when converting P and PA #5824 [radarhere]

    • Improved putdata() documentation and data handling #5910 [radarhere]

    • Exclude carriage return in PDF regex to help prevent ReDoS #5912 [hugovk]

    • Fixed freeing pointer in ImageDraw.Outline.transform #5909 [radarhere]

    • Added ImageShow support for xdg-open #5897 [m-shinder, radarhere]

    • Support 16-bit grayscale ImageQt conversion #5856 [cmbruns, radarhere]

    • Convert subsequent GIF frames to RGB or RGBA #5857 [radarhere]

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • NameError: name 'main_file' is not defined

    NameError: name 'main_file' is not defined

    2022-05-04 15:19:43.543 | WARNING | differential.utils.mediainfo:get_resolution:183 - 无法获取到视频的分辨率 2022-05-04 15:19:43.544 | ERROR | main::8 - An error has been caught in function '', process 'MainProcess' (933041), thread 'MainThread' (140306609316480): Traceback (most recent call last):

    File "/home/lei/.pyenv/versions/3.9.10/bin/dft", line 8, in sys.exit(main()) │ │ └ <function main at 0x7f9baca2bc10> │ └ └ <module 'sys' (built-in)> File "/home/lei/.pyenv/versions/3.9.10/lib/python3.9/site-packages/differential/main.py", line 24, in main REGISTERED_PLUGINSplugin.upload() │ │ └ {'generate_nfo': False, 'make_torrent': True, 'screenshot_count': 0, 'optimize_screenshot': 'true', 'image_hosting': <ImageHo... │ └ 'NexusPHP' └ {'nexusphp': <class 'differential.plugins.nexusphp.NexusPHP'>, 'nexus': <class 'differential.plugins.nexusphp.NexusPHP'>, 'ne... File "/home/lei/.pyenv/versions/3.9.10/lib/python3.9/site-packages/differential/plugins/base.py", line 1079, in upload self._prepare() │ └ <function Base._prepare at 0x7f9bab4a6ee0> └ <differential.plugins.nexusphp.NexusPHP object at 0x7f9bab411be0> File "/home/lei/.pyenv/versions/3.9.10/lib/python3.9/site-packages/differential/plugins/base.py", line 796, in _prepare self._screenshots = self._get_screenshots() │ │ │ └ <function Base._get_screenshots at 0x7f9bab4a6e50> │ │ └ <differential.plugins.nexusphp.NexusPHP object at 0x7f9bab411be0> │ └ [] └ <differential.plugins.nexusphp.NexusPHP object at 0x7f9bab411be0> File "/home/lei/.pyenv/versions/3.9.10/lib/python3.9/site-packages/differential/plugins/base.py", line 765, in _get_screenshots temp_dir = self._make_screenshots() │ └ <function Base._make_screenshots at 0x7f9bab4a6dc0> └ <differential.plugins.nexusphp.NexusPHP object at 0x7f9bab411be0> File "/home/lei/.pyenv/versions/3.9.10/lib/python3.9/site-packages/differential/plugins/base.py", line 719, in _make_screenshots duration = get_duration(self._mediainfo) │ │ └ <pymediainfo.MediaInfo object at 0x7f9bad5c4f70> │ └ <differential.plugins.nexusphp.NexusPHP object at 0x7f9bab411be0> └ <function get_duration at 0x7f9babeedee0> File "/home/lei/.pyenv/versions/3.9.10/lib/python3.9/site-packages/differential/utils/mediainfo.py", line 174, in get_duration logger.error(f"未找到视频Track,请检查{main_file}是否为支持的文件") │ └ <function Logger.error at 0x7f9bacb09550> └ <loguru.logger handlers=[(id=0, level=10, sink=), (id=1, level=5, sink='test.log')]>

    NameError: name 'main_file' is not defined

    bug 
    opened by LeiShi1313 0
Releases(0.6.2)
Owner
Lei Shi
咸鱼一个
Lei Shi