Skip to main content

Differential 差速器

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

为什么叫差速器

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

差速器能做什么?

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

如何安装差速器

可以移步我的博客查看详细的教程 也可以到Telegram群组来讨论各种问题

Linux

一键脚本安装

对于当前稳定版Debian/Ubuntu、Fedora、RHEL/CentOS/Rocky/AlmaLinux以及Archlinux,可以使用一键脚本安装。脚本会安装ffmpeg、mediainfo、pipx和原生BDInfoCLI。

curl -Lso- https://raw.githubusercontent.com/LeiShi1313/Differential/main/install.sh | bash

手动安装

# 安装ffmpeg和mediainfo
sudo apt install ffmpeg mediainfo zlib1g-dev libjpeg-dev curl

# 安装原生BDInfoCLI,ARM64请把linux-x64替换为linux-arm64
curl -L -o /tmp/BDInfo-linux-x64.tar.gz https://github.com/tetrahydroc/BDInfoCLI/releases/download/v1.0.5/BDInfo-linux-x64.tar.gz
tar -xzf /tmp/BDInfo-linux-x64.tar.gz -C /tmp
sudo install -m 755 /tmp/BDInfo-linux-x64/BDInfo /usr/local/bin/BDInfo

pip3 install Differential

Windows

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

pip.exe install Differential

Mac OS

一键脚本安装

macOS需要先安装Homebrew,然后可以使用一键脚本安装。脚本会通过Homebrew安装ffmpeg、mediainfo和pipx,并安装对应CPU架构的原生BDInfoCLI。

curl -Lso- https://raw.githubusercontent.com/LeiShi1313/Differential/main/install.sh | bash

手动安装

# 安装ffmpeg、mediainfo、pipx
brew install ffmpeg mediainfo pipx

# 安装原生BDInfoCLI,Apple Silicon请把osx-x64替换为osx-arm64
curl -L -o /tmp/BDInfo-osx-x64.tar.gz https://github.com/tetrahydroc/BDInfoCLI/releases/download/v1.0.5/BDInfo-osx-x64.tar.gz
tar -xzf /tmp/BDInfo-osx-x64.tar.gz -C /tmp
sudo install -m 755 /tmp/BDInfo-osx-x64/BDInfo /usr/local/bin/BDInfo

pipx ensurepath
pipx install Differential

Docker

docker pull leishi1313:differential
docker run --rm -v [你的媒体文件夹]:[媒体文件夹路径] -v ./config.ini:/app/config.ini leishi1313:differential dft -h

如何使用差速器

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

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

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

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

主要参数介绍:

  • config: 配置文件的位置,默认读取当前文件夹下的config.ini
  • log: log文件的路径
  • folder: 种子文件或文件夹的路径
  • url: 影片的豆瓣链接,事实上,所有PtGen Archive支持的链接这里都支持,差速器会自动通过Ourhelp CDN、GitHub Pages和Ourhelp API provider获取并生成介绍内容
  • upload_url: 发种页面的地址
  • make_torrent: 是否制种,默认关闭
  • geenrate_nfo: 是否利用mediainfo生成nfo文件,默认关闭
  • use_short_bdinfo: 是否使用BDInfo的Quick Summary,默认使用完整的BDInfo
  • 原盘BDInfo扫描:Windows使用内置BDInfo;Linux/Mac优先使用PATH或BDINFOPATH中的原生BDInfo,找不到时回退到Mono运行内置BDInfo
  • screenshot_count: 截图生成的张数,默认为0,即不生成截图
  • screenshot_tonemap: 生成截图时是否使用ffmpeg tonemap滤镜将HDR/DoVi转换到BT.709,默认auto自动检测,可选always强制开启或never关闭
  • image_hosting: 图床的名称,现在支持ptpimg,chevereto,imgurl和SM.MS
  • image_hosting_url: 如果是自建的图床,提供图床链接
  • announce_url: 制种时的announce地址
  • encoder_log: 压制log的地址,如果提供的话会在介绍的mediainfo部分附上压制log
  • easy_upload: 默认关闭,开启的话会利用easy-upload自动填充发种页面表单
  • auto_feed: 默认关闭,开启的话会利用auto_feed_js自动填充发种页面表单
  • trim_description: 默认关闭,开启的话会省略掉上传链接的描述部分,以避免链接过长浏览器无法打开的问题
  • use_short_url: 默认关闭,开启的话使用短链接服务把上传链接缩短

dft-rename 媒体重命名

dft-rename 可以根据媒体扫描结果和 PtGen 信息生成 PT 常见命名,并重命名媒体文件夹和其中的主要媒体文件。原盘/BDMV 默认只重命名顶层文件夹,不改动 BDMV 内部文件。

dft-rename /path/to/media -u [豆瓣或IMDb URL]
dft-rename /path/to/media --title "Movie Title" --year 2024 --source NF --type WEB-DL --uploader GROUP
dft-rename /path/to/media --title "Movie Title" --year 2024 --yes

默认是交互式预览确认。--dry-run 只打印计划,--json 输出机器可读计划,--yes 直接执行且不会从旧文件名推断 source 或 uploader。如果当前工作目录存在 config.ini,dft-rename 会读取其中的 [Rename]、[RenameWords]、[RenameReleaseGroups] 和 [RenameCodecMap];也可以用 --config /path/to/config.ini 指定配置文件。命令行参数优先级高于配置文件。

[Rename] 可设置常用默认 token,例如:

[Rename]
source = NF
type = WEB-DL
uploader = GROUP
include_info_sidecars = false
folder_only = false
scan_bdinfo = true

source 和 type 会分开输出,比如 NF.WEB-DL。不要把它们合成一个 source = NF.WEB-DL。

[RenameWords] 会在解析旧文件名前运行,用来屏蔽不应处理的名称或修正常见噪声。block 先于 replace 执行;普通规则默认大小写不敏感;正则规则需要显式 regex: 前缀。

[RenameWords]
block =
    sample
    regex:\btrailer\b
replace =
    WEB DL => WEB-DL
    regex:\s+=> .

[RenameReleaseGroups] 可配置项目自有 release group/uploader 名称。配置后会优先用这里的规范写法;未命中时仍会保留保守的末尾 -GROUP / @GROUP 识别。--yes 仍不会自动采用旧文件名推断出的 uploader。

[RenameReleaseGroups]
groups =
    UBits
    ADWeb
    HDSWEB

[RenameCodecMap] 用来定义偏好的最终视频/音频 codec 写法。映射发生在内置规范化之后:

[RenameCodecMap]
video.H.264 = H264
video.HEVC = H265
audio.AAC2.0 = AAC
audio.DTS-HD.MA5.1 = DTS-HD.MA.5.1

其他插件

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

支持的图

目前支持以下图床:

  • ptpimg: 适用于PTP等站点,需注册账号获取API Key。

  • hdbits: 适用于HDB等站点

  • chevereto: 支持自建Chevereto图床,需提供图床URL和API信息。

  • imgurl: 支持imgurl自建图床,需提供相关API信息。

  • SM.MS: 免费公共图床,支持API上传。

  • imgbox: 免费图床.

  • LKSY: 支持兰空LSKY Pro自建图床,可使用API Token或者邮箱密码验证

如需使用自建图床,请在配置文件中填写image_hosting_url等相关参数。

TODO

  • 更好的出错管理
  • PTGen API Key支持
  • imgbox支持
  • 短网址服务
  • 识别已经生成过的截图,不重复截图
  • 支持扫描原盘BDInfo

Metadata

Release files for Differential 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Differential 0.8.2
File Size Uploaded
differential-0.8.2.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for Differential 0.8.2
File Interpreter ABI Platform
differential-0.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / differential-0.8.2.tar.gz

Download URL differential-0.8.2.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
6778239301011185970e6973a37d101d42478eccd53dd1f8daa2fe27bde0f772
BLAKE2b-256 checksum
How to use checksums
7e3780ca7815c38da0b29dc4051c192f9346d7203492a15837e794928101cc5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / differential-0.8.2-py3-none-any.whl

Download URL differential-0.8.2-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4dc7b201aa04027ec321090ef5224cfe8e61865b5d2d4bd073e186451750b7c2
BLAKE2b-256 checksum
How to use checksums
ac4885e3d4e27053683a948b63510c22dcc2ba31b70c6494232ebab13386b4f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.8.2 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.9

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page