在不同平台使用不同的方式,创建并发布种子。Windows、macOS可以通过可视化工具,群晖 NAS、Linux、macOS等平台还可以通过命令行创建种子,并且可以对种子进行二次修改,添加 trakcer 等。
mktorrent(Linux/macOS)
Linux 下制作种子的工具用到 mktorrent。
安装 mktorrent
Debian:
sudo apt install mktorrent
macOS:
brew install mktorrent
在群晖上通过 Docker 创建一个 Debian 容器进行操作,另外通常玩群晖都会使用 Transmission,可以直接使用这个容器。另外 Transmission 也提供了创建种子的工具,后面也会介绍。
了解 mktorrent
➜ ~ mktorrent -h
示例: mktorrent [可选参数] <目标目录或者文件路径>
可选参数:
-a, --announce=<url>[,<url>]* : 指定完整的公告 URL,至少需要一个
附加 -a 添加备用的 trackers
-c, --comment=<comment> : 给元信息添加备注
-d, --no-date : 不写入创建日期
-h, --help : 显示帮助信息
-l, --piece-length=<n> : 将分片长度设置为 2^n 字节,默认 18
即 2^18 = 256kb
-n, --name=<name> : 设置 torrent 的名称,
默认为目标的基本名称
-o, --output=<filename> : 设置创建文件的路径和文件名
默认为 <文件名>.torrent
-p, --private : 设置私有种子标志
-s, --source=<source> : 在 infohash 中添加嵌入的源字符串
-t, --threads=<n> : 使用 <n> 线程计算哈希值
默认为 CPU 核心数
-v, --verbose : 输出详细信息
-w, --web-seed=<url>[,<url>]* : 添加网络种子 URL
附加 -w 添加更多 URL
使用示例
制作单个文件的私有 PT 种子,比如常见的 PT 电影资源。
- PT 只有一个 Tracker;
- 分片大小设置为 4M;
mktorrent -a https://tracker.dmhy.org/announce \
-l 22 -p -v \
-o Sully.2016.BluRay.2160p.x265.10bit.HDR.torrent \
Sully.2016.BluRay.2160p.x265.10bit.HDR.mkv
制作多个文件的常规 BT 种子
- 将需要添加到种子的文件放到一个目录中;
- 尽量添加多个 Tracker,避免被墙;
- 分片大小设置为 2M;
mktorrent -a http://tracker.bt4g.com:2095/announce \
-a http://www.wareztorrent.com:80/announce \
-a udp://opentracker.io:6969/announce \
-l 21 -v \
-o RVC20240604Nvidia.torrent \
RVC20240604Nvidia
Transmission (NAS)
以群晖 NAS 为例,添加社群套件来源。
其他平台可以安装transmission-cli
包来使用。
在社群套件中安装 Transmission。
为了便于使用,将 transmission-create 等命令添加到环境变量中。这里我使用的 shell 解释器是 zsh,请根据自己的情况添加对应的启动文件中。
echo "export PATH=/volume1/@appstore/transmission/bin:$PATH" >> ~/.zshenv
使用 transmission-create 命令创建种子。
Usage: transmission-create [options] <file|directory>
Options:
-h --help Display this help page and exit
-p --private Allow this torrent to only be used with the specified
tracker(s)
-r --source <source> Set the source for private trackers
-o --outfile <file> Save the generated .torrent to this filename
-s --piecesize <KiB> Set the piece size in KiB, overriding the preferred
default
-c --comment <comment> Add a comment
-t --tracker <url> Add a tracker's announce URL
-w --webseed <url> Add a webseed URL
--anonymize Omit "Creation date" and "Created by" info
-V --version Show version number and exit
创建一个私有种子,分片大小 2M(注意 Transmission 分片的单位和 mktorrent 不相同)。
transmission-create -p -s 2048 \
-o fftotalbundle.torrent \
-t https://tracker.example.com/announce \
-c SIMAEK -r simaek.com
--anonymize fftotalbundle.dmg
使用 transmission-show 查看创建的种子信息。
➜ ~ transmission-show fftotalbundle.torrent
Name: fftotalbundle.dmg
File: fftotalbundle.torrent
GENERAL
Name: fftotalbundle.dmg
Hash v1: 6e78a73188dad3851b3659e48e6aca116075987c
Created by: Transmission/4.0.6 (38c164933e)
Created on: Thu Oct 31 17:34:08 2024
Piece Count: 119
Piece Size: 2.00 MiB
Total Size: 248.6 MB
Privacy: Private torrent
TRACKERS
Tier #1
https://tracker.example.com/announce
FILES
fftotalbundle.dmg (248.6 MB)
修改种子信息
Transmission (Linux/macOS/NAS)
在我的 macOS 上进行实验。
brew install transmission-cli
使用 transmission-edit 命令修改种子信息,支持添加 tracker,删除 tracker,添加源。
Usage: transmission-edit [options] torrent-file(s)
Options:
-h --help Display this help page and exit
-a --add <url> Add a tracker's announce URL
-d --delete <url> Delete a tracker's announce URL
-r --replace <old> <new> Search and replace a substring in the announce URLs
-s --source <source> Set the source
-V --version Show version number and exit
添加更多 tracker:
###
transmission-edit -a https://tracker2.example.com/announce fftotalbundle.torrent
fftotalbundle.torrent
Added 'https://tracker2.example.com/announce' to 'announce-list' tier #2
Changed 1 files
批量替换 tracker,将 tracker 中 example.com 全部替换成 hd.com。
transmission-edit -r example.com hd.com fftotalbundle.torrent
fftotalbundle.torrent
Replaced in 'announce': 'https://tracker.example.com/announce' --> 'https://tracker.hd.com/announce'
Replaced in 'announce-list' tier #1: 'https://tracker.example.com/announce' --> 'https://tracker.hd.com/announce'
Replaced in 'announce-list' tier #2: 'https://tracker2.example.com/announce' --> 'https://tracker2.hd.com/announce'
Changed 1 files
transmission-edit 提供的修改选项比较少,并且这些修改不会改变种子的 Hash 值。
Torrent File Editor(Windows/macOS)
这是一个带有 GUI 的种子修改器,可修改属性非常全面,但是需要注意一些属性可能导致种子 Hash 发生变化。
同时这个工具也支持创建种子。
发布种子
以 Transmission 为例,首先将种子中的所有文件放置到 Transmission 可以访问到的下载目录,然后添加种子下载任务,下载文件选择种子文件所在位置。
Transmission 会对种子进行校验,校验完成显示下载进度100%。
最后启动任务做种即可。
关于分片大小选择
- 2^18, 256 KB,通常用在目标文件在 512 MiB 以下
- 2^19, 512 KB,通常用在目标文件在 512 MiB - 1024 MiB
- 2^20, 1024 KB,通常用在目标文件在 1 GB - 2GB
- 2^21, 2048 KB,通常用在目标文件在 2 GB - 4GB
- 2^22, 4096 KB,通常用在目标文件在 4 GB - 8GB
- 2^23, 8192 KB,通常用在目标文件在 8 GB - 16GB
- 2^24, 16384 KB,通常用在目标文件在 16 GB - 512GB,通常这是日常使用应该用的最大的块大小