Scroll to navigation

TORRENTINFO(1) torrentinfo TORRENTINFO(1)

NAME

torrentinfo - torrentinfo Documentation

This documentation aims to provide at least an overview of what to expect when using or scripting against torrentinfo.

ABOUT

torrentinfo parses .torrent files and displays information about the torrent and the files that it references. On the default basic setting it shows:

  • Torrent name
  • Tracker URL
  • The creator of the torrent
  • The torrent's creation date
  • The number of files (if a multi-file torrent)
  • The name of the file (if a single-file torrent)
  • The total size of the file/files



If asked to display file information the path and size of each file is listed.

Additionally the entire torrent can be shown in hierachical form.

WHY FORK?

I forked the original project simply because it was missing functionality I desired, namely what the -t flag does now. It turned out that the code was an undocummented mess but it worked so no one bothered. It was no longer listed on the creators website and the original creator was surprised that anyone even found it useful. For this reason I decided to the dust off the project, clean it up, document it and provide a few tests along the way.

I'm keeping the original name of the project in case someone (like me) finds themself in a similar position and does a Google search for "torrentinfo".

USAGE

usage: torrentinfo [-h] [-v] [-t | -f | -d] [-a] [-n] filename [filename ...]:

Print information about torrent files
positional arguments:

filename Torrent files to process optional arguments:
-h, --help show this help message and exit
-v, --version Print version and quit
-t, --top Only show top level file/directory
-f, --files Show files within the torrent
-d, --detailed Print more information about the files
-e, --everything Print everything we can about the torrent
-a, --ascii Only print out ascii
-n, --nocolour No ANSI colour


If no settings are specified the script will default to showing the basic information on each file.

BUGS

Any bugs or fixes should be submitted to my GitHub <https://github.com/Fuuzetsu/torrentinfo>.

CREDITS

I like to give credit where it's due. Vrai Stacey <http://vrai.net> is the original creator but no longer maintains the project .

TORRENTINFO

Parses .torrent files and displays various summaries of the information contained within.

Published under the GNU Public License: http://www.gnu.org/copyleft/gpl.html


String processing class.
Raised when the buffer goes past EOF.

Raised when the buffer doesn't find the expected character.

Gets certain amount of characters from the buffer.
length (int) -- Number of characters to get from the buffer
str -- first length characters from the buffer
BufferOverrun


Gets all characters in a string until the specified one, exclusive.
character (str) -- Character until which the string should be collected
str -- collected string from the buffer up to character
CharacterExpected


Checks whether we're at the end of the string.
bool -- true if this instance reached end of line


Peeks at the next character in the string.
str -- next character of this instance
BufferOverrun


A get method called when bytes are encountered. Casts into unicode where at all possible or uses the replacement character otherwise.
  • length (int) -- number of characters to get from the buffer
  • destructive (bool) -- decides whether to progress the buffer
  • replacement (str) -- Replacement to use character if unicode decode fails

str -- Unicode string from the string buffer



Class used to format strings before printing.
Attaches colour codes to strings before outputting them.
  • format_spec (int) -- value of the colour code
  • string (str) -- string to colour




A class modelling a parsed torrent file.

Thrown when the torrent file is not just a single dictionary

Thrown when Torrent.parse encounters unexpected character

Prints out basic information about a Torrent instance.
  • config (Config) -- configuration object to use in this method
  • torrent (Torrent) -- torrent instance to use for information



Prints out basic file information of a Torrent instance.
  • config (Config) -- configuration object to use in this method
  • torrent (Torrent) -- torrent instance to use for information



Decodes a bencoded string.
string_buffer (StringBuffer) -- bencoded torrent file content buffer
dict


Printing method.
  • item (dict or list or str or int) -- item to print
  • config (Config) -- configuration object to use in this method
  • depth (int) -- indentation depth
  • newline (bool) -- indicates whether to insert a newline after certain strings
  • as_utf_repr (bool) -- indicates whether only ASCII should be printed



Dumps out the Integer instance as a date.
  • n (int) -- number to format
  • config (Config) -- configuration object to use in this method



Dumps the string to the stdout as file size after formatting it.
  • n (int) -- number to format
  • config (Config) -- configuration object to use in this method
  • depth (int) -- indentation depth



Parses command-line arguments.
ArgumentParser


Print lines from a torrent instance.
  • config (Config) -- configuration object to use in this method
  • prefix (str) -- prefix to insert in front of the line
  • key (str) -- key name in the torrent to print out
  • torrent (Torrent) -- torrent instance to use for information
  • depth (int) -- indentation depth
  • is_date (bool) -- indicates whether the line is a date
  • format_spec (int) -- default colour to use for the text



Checks whether a string is ascii only.
string (str) -- string to check
bool


Prints out a list of files using a Torrent instance
  • config (Config) -- configuration object to use in this method
  • torrent (Torrent) -- torrent instance to use for information
  • detailed -- indicates whether to print more information about files
  • detailed -- bool



Loads file contents from a torrent file
filename (str:) -- torrent file path
StringBuffer



Print the first line during information output.
  • config (Config) -- configuration object to use in this method
  • prefix (str) -- prefix to insert in front of the line
  • depth (int) -- indentation depth
  • postfix (str) -- postfix to insert at the back of the line
  • format_spec (int) -- default colour to use for the text



Prints out the top file/directory name as well as torrent file name.
  • config (Config) -- configuration object to use in this method
  • torrent (Torrent) -- torrent instance to use for information



AUTHOR

Mateusz Kowalczyk

COPYRIGHT

2024, Mateusz Kowalczyk

__DATE__ 1.8