如何使用命令行创建 .torrent?

如何使用命令行创建 .torrent?

我正在使用 mktorrent,但是我遇到了问题,因为出于某些奇怪的原因它没有对目录中的文件进行哈希处理...

我正在寻找专门用于命令行的替代品

答案1

怎么样ctorrent

sudo apt-get install ctorrent
ctorrent -t -u "http://tracker.example.com:6969/announce" -s example.torrent file_or_dir_to_upload 

它也是一个很好的客户

答案2

传输可以做到这一点:

$ ./transmission-create --help
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)
 -o --outfile <file>    Save the generated .torrent to this filename
 -c --comment <comment> Add a comment
 -t --tracker <url>     Add a tracker's announce URL
 -V --version           Show version number and exit

例如:

transmission-create -o /var/lib/transmission-daemon/downloads/files.torrent -c "My comments" -t udp://tracker.openbittorrent.com:80 ~/torrent/complete/my_file_or_directory_to_share.extension

您可以找到更多文档这里

答案3

构建torrent

sudo apt-get install buildtorrent

来自突触:

描述:命令行 torrent 创建程序

buildtorrent 是一个 torrent 文件创建程序。给定一个公告 URL 和一个输入文件或目录,buildtorrent 会生成一个可供 torrent 客户端使用的输出 .torrent 文件。

答案4

您可以使用torrenttools

sudo add-apt-repository ppa:fbdtemme/torrenttools
sudo apt-get update
sudo apt install torrenttools
Create BitTorrent metafiles.
Usage: torrenttools create [OPTIONS] target

Positionals:
  target <path>                    Target filename or directory

Options:
  -h,--help                        Print this help message and exit
  -v,--protocol <protocol>         Set the bittorrent protocol to use.
                                   Options are 1, 2 or hybrid. [default: 1]
  -o,--output <path>               Set the filename and/or output directory of the created file.
                                   [default: <name>.torrent]
                                   Use a path with trailing slash to only set the output directory.
  -a,--announce <url>...           Add one or multiple announces urls.
                                   Multiple trackers will be added in seperate tiers by default. 
                                   Use square brackets to groups urls in a single tier:
                                   eg. "--announce url1 [url1 url2]"
  -g,--announce-group <name>...    Add the announce-urls defined from an announce group specified in the configuration file.
                                   Multiple groups can be passed. eg. "--announce-group group1 group2"
  -w,--web-seed <url>...           Add one or multiple HTTP/FTP urls as seeds.
  -d,--dht-node <host:port>...     Add one or multiple DHT nodes.
  -c,--comment <string>            Add a comment.
  -p,--private <[on|off]>          Set the private flag to disable DHT and PEX.
  -l,--piece-size <size[K|M]>      Set the piece size.
                                   When no unit is specified block size will be either 2^<n> bytes,
                                   or <n> bytes if n is larger or equal to 16384.
                                   Piece size must be a power of two in range [16K, 64M].
                                   Leave empty or set to auto to determine by total file size. [default: auto]
  -s,--source <source>             Add a source tag to facilitate cross-seeding.
  -n,--name <name>                 Set the name of the torrent. This changes the filename for single file torrents 
                                   or the root directory name for multi-file torrents.
                                   [default: <basename of target>]
  -t,--threads <n>                 Set the number of threads to use for hashing pieces. [default: 2]
  --checksum <algorithm>...        Include a per file checksum of given algorithm.
  --no-creation-date               Do not include the creation date.
  --creation-date <ISO-8601|POSIX time>
                                   Override the value of the creation date field as ISO-8601 time or POSIX time.
                                   eg.: "2021-01-22T18:21:46+0100"
  --no-created-by                  Do not include the name and version of this program.
  --created-by <string>            Override the value of the created by field.
  --include <regex>...             Only add files matching given regex to the metafile.
  --exclude <regex>...             Do not add files matching given regex to the metafile.
  --include-hidden                 Do not skip hidden files.
  --io-block-size <size[K|M]>      The size of blocks read from storage.
                                   Must be larger or equal to the piece size.

免责声明:我是该工具的作者。

查看文档了解更多信息和示例。

相关内容