Skip to main content

CLI tool to create, read and edit torrent files

Project description

torf-cli is a command line tool that can create torrents and magnet links, dump the metainfo of a torrent, and edit existing torrents (e.g. to fix a typo without having to hash all the pieces again).

The output is pleasant to read for humans and easy to parse with common CLI tools if stdout is not a TTY.

An optional configuration file specifies custom default options and profiles that give names to sets of options.

Documentation is available as a man page, or you can read it here.

The only depdencies are torf and pyxdg.

Examples

Create private torrent with two trackers:

$ torf ./docs -t http://bar:123/announce -t http://baz:321/announce --private
       Name  docs
       Size  60.1 KiB
    Created  2018-06-19 14:47:26
    Private  yes
   Trackers  http://bar:123/announce
             http://baz:321/announce
 Piece Size  16 KiB
Piece Count  4
 File Count  3
      Files  docs
             ├─torf.1
             ├─torf.1.asciidoc
             └─torf.1.html
       Path  docs
   Progress  100.00 %  |  Time: 0:00:00  |  58.84 MB/s
  Info Hash  215f506179b6526b582e4fb78ebc24dd1f2a791f
     Magnet  magnet:?xt=urn:btih:215f506179b6526b582e4fb78ebc24dd1f2a791f&dn=docs&xl=61542&tr=http%3A%2F%2Fbar%3A123%2Fannounce&tr=http%3A%2F%2Fbaz%3A321%2Fannounce
    Torrent  docs.torrent

Display metainfo of an existing torrent:

$ torf -i docs.torrent
       Name  docs
  Info Hash  215f506179b6526b582e4fb78ebc24dd1f2a791f
       Size  60.1 KiB
    Created  2018-06-19 14:47:26
    Private  yes
   Trackers  http://bar:123/announce
             http://baz:321/announce
 Piece Size  16 KiB
Piece Count  4
 File Count  3
      Files  docs
             ├─torf.1
             ├─torf.1.asciidoc
             └─torf.1.html
     Magnet  magnet:?xt=urn:btih:215f506179b6526b582e4fb78ebc24dd1f2a791f&dn=docs&xl=61542&tr=http%3A%2F%2Fbar%3A123%2Fannounce&tr=http%3A%2F%2Fbaz%3A321%2Fannounce

Quickly add a comment to an existing torrent:

$ torf -i docs.torrent --comment 'Forgot to add this comment.' -o docs.revised.torrent
       Name  docs
  Info Hash  215f506179b6526b582e4fb78ebc24dd1f2a791f
       Size  60.1 KiB
    Comment  Forgot to add this comment.
    Created  2018-06-19 14:47:26
    Private  yes
   Trackers  http://bar:123/announce
             http://baz:321/announce
 Piece Size  16 KiB
Piece Count  4
 File Count  3
      Files  docs
             ├─torf.1
             ├─torf.1.asciidoc
             └─torf.1.html
     Magnet  magnet:?xt=urn:btih:215f506179b6526b582e4fb78ebc24dd1f2a791f&dn=docs&xl=61542&tr=http%3A%2F%2Fbar%3A123%2Fannounce&tr=http%3A%2F%2Fbaz%3A321%2Fannounce
    Torrent  docs.revised.torrent

Get a list of files:

$ torf -i docs.revised.torrent | grep '^Files' | cut -f2-
docs/torf.1     docs/torf.1.asciidoc    docs/torf.1.html

Installation

The latest release is available on PyPI and on AUR.

pipsi

The easiest and cleanest installation method is pipsi, which installs each application with all dependencies in a separate virtual environment in ~/.local/venvs/ and links the executable to ~/.local/bin/.

$ pipsi install torf-cli
$ pipsi upgrade torf-cli
$ pipsi uninstall torf-cli  # Also removes dependencies

The only drawback is that, at the time of writing, pipsi doesn’t make the man page available. But you can just read it in your browser.

pip

The alternative is regular pip, but if you decide to uninstall, you have to manually uninstall the dependencies.

$ pip3 install torf-cli         # Installs system-wide (/usr/local/)
$ pip3 install --user torf-cli  # Installs in your home (~/.local/)

The latest development version is available on GitHub in the master branch.

$ pip3 install [--user] git+https://github.com/rndusr/torf-cli.git

Contributing

Bug reports and feature requests are welcome in the issue tracker.

License

torf-cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torf-cli-3.0.1.tar.gz (14.8 kB view hashes)

Uploaded Source

Built Distribution

torf_cli-3.0.1-py3-none-any.whl (31.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page