TORRENTINFO(1)
π TORRENTINFO(1) π
hiii bestie, welcome to torrentinfo(1) β the manual page for torrentinfo, which is literally a whole mood. This doc's whole goal? To give you at least an overview of what you're getting into when you use torrentinfo or script against it. π«Ά
β¨ NAME β¨
torrentinfo β torrentinfo Documentation.
No cap, this documentation aims to provide at least an overview of what to expect when using or scripting against torrentinfo. That's the assignment. π
πΈ ABOUT πΈ
okay so torrentinfo parses .torrent files and displays information about the torrent and the files that it references. That's the whole vibe. β¨
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. cute, right? π
Additionally, the entire torrent can be shown in hierarchical form β like a little tree of everything. iconic. π
π¦ WHY FORK? π¦
ngl, 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". iykyk. π₯
π USAGE π
usage: torrentinfo [-h] [-v] [-t | -f | -d] [-a] [-n] filename [filename
...]:
Print information about torrent files β that's the whole thing, bestie.
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
now let's break those flags down like a group chat read-receipt situation π
π positional arguments
filenameβ Torrent files to process. yeah girl, you can toss more than one at it β¨
π optional arguments
-h,--helpβ show this help message and exit. the classic escape hatch πͺ-v,--versionβ Print version and quit. one job, does it flawlessly π-t,--topβ Only show top level file/directory. the whole reason for the fork, lowkey π-f,--filesβ Show files within the torrent. peek inside π-d,--detailedβ Print more information about the files. give me the lore π-e,--everythingβ Print everything we can about the torrent. main character energy, no crumbs left π€-a,--asciiβ Only print out ascii. for the plain-text girlies π«Ά-n,--nocolourβ No ANSI colour. turning the sparkle off, respectfully β¨βπΆ
If no settings are specified the script will default to showing the basic information on each file. it's giving "sensible defaults", fr fr.
π BUGS π
Any bugs or fixes should be submitted to my GitHub <https://github.com/Fuuzetsu/torrentinfo>. pls and thank you π«Ά
π 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 . (yes that space before the period is part of the original, we're keeping it, don't @ me π)
π TORRENTINFO π
Parses .torrent files and displays various summaries of the information contained within. that's the mission statement, periodt. π
Published under the GNU Public License: <http://www.gnu.org/copyleft/gpl.html> π
okay so now we're getting into the actual API and it's a lot but stay with me, we're going section by section and every single parameter is coming with us π§
π class torrentinfo.Config(formatter, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, err=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, tab_char=' ')
Class storing configuration propagated throughout the program. yes, tab_char is a space by default, that's just how it is π«Ά
πΈ class torrentinfo.StringBuffer(string)
String processing class. the little engine that could β¨
exception BufferOverrun
Raised when the buffer goes past EOF. you went too far, babe π
exception CharacterExpected
Raised when the buffer doesn't find the expected character. rude but fair π
get(length)
Gets certain amount of characters from the buffer.
- Parameters
length(int) β Number of characters to get from the buffer
- Returns β
strβ firstlengthcharacters from the buffer - Raises
BufferOverrun
get_upto(character)
Gets all characters in a string until the specified one, exclusive. like, stop before the character, don't include it π
- Parameters
character(str) β Character until which the string should be collected
- Returns β
strβ collected string from the buffer up tocharacter - Raises
CharacterExpected
is_eof()
Checks whether we're at the end of the string. vibe check on the buffer π¦
- Returns β
boolβ true if this instance reached end of line
peek()
Peeks at the next character in the string. just a lil look, no touching π
- Returns β
strβ next character of this instance - Raises
BufferOverrun
unicode_get(length, destructive=True, replacement='Γ')
A get method called when bytes are encountered. Casts into unicode where at all possible or uses the replacement character otherwise.
- Parameters
length(int) β number of characters to get from the bufferdestructive(bool) β decides whether to progress the bufferreplacement(str) β Replacement to use character if unicode decode fails
- Returns β
strβ Unicode string from the string buffer
π class torrentinfo.TextFormatter(colour)
Class used to format strings before printing. the glam squad of the codebase β¨
string_format(format_spec, config, string='')
Attaches colour codes to strings before outputting them.
- Parameters
format_spec(int) β value of the colour codestring(str) β string to colour
π class torrentinfo.Torrent(filename, string_buffer)
A class modelling a parsed torrent file. the main character, honestly π
exception torrentinfo.UnexpectedType
Thrown when the torrent file is not just a single dictionary. it wanted one dict, it got something else, it's not okay π
exception torrentinfo.UnknownTypeChar
Thrown when Torrent.parse encounters unexpected character. that character was not on the guest list π
π«Ά torrentinfo.basic(config, torrent)
Prints out basic information about a Torrent instance.
- Parameters
config(Config) β configuration object to use in this methodtorrent(Torrent) β torrent instance to use for information
π torrentinfo.basic_files(config, torrent)
Prints out basic file information of a Torrent instance.
- Parameters
config(Config) β configuration object to use in this methodtorrent(Torrent) β torrent instance to use for information
β torrentinfo.decode(string_buffer)
Decodes a bencoded string.
- Parameters
string_buffer(StringBuffer) β bencoded torrent file content buffer
- Returns β
dict
π torrentinfo.dump(item, config, depth, newline=True, as_utf_repr=False)
Printing method.
- Parameters
item(dict or list or str or int) β item to printconfig(Config) β configuration object to use in this methoddepth(int) β indentation depthnewline(bool) β indicates whether to insert a newline after certain stringsas_utf_repr(bool) β indicates whether only ASCII should be printed
πΈ torrentinfo.dump_as_date(number, config)
Dumps out the Integer instance as a date.
- Parameters
n(int) β number to formatconfig(Config) β configuration object to use in this method
π¦ torrentinfo.dump_as_size(number, config, depth)
Dumps the string to the stdout as file size after formatting it.
- Parameters
n(int) β number to formatconfig(Config) β configuration object to use in this methoddepth(int) β indentation depth
π
torrentinfo.get_arg_parser()
Parses command-line arguments.
- Returns β
ArgumentParser
π₯ torrentinfo.get_line(config, prefix, key, torrent, is_date=False)
Print lines from a torrent instance.
- Parameters
config(Config) β configuration object to use in this methodprefix(str) β prefix to insert in front of the linekey(str) β key name in the torrent to print outtorrent(Torrent) β torrent instance to use for informationdepth(int) β indentation depthis_date(bool) β indicates whether the line is a dateformat_spec(int) β default colour to use for the text
π§ torrentinfo.is_ascii_only(string)
Checks whether a string is ascii only.
- Parameters
string(str) β string to check
- Returns β
bool
π torrentinfo.list_files(config, torrent, detailed=False)
Prints out a list of files using a Torrent instance.
- Parameters
config(Config) β configuration object to use in this methodtorrent(Torrent) β torrent instance to use for informationdetailedβ indicates whether to print more information about filesdetailedβbool
(yes, detailed is listed twice there β once describing it, once giving its type. that's how the original rolls, we don't fix what isn't asked to be fixed π)
π torrentinfo.load_torrent(filename)
Loads file contents from a torrent file.
- Parameters
filename(str:) β torrent file path
- Returns β
StringBuffer
π torrentinfo.main(alt_args=None, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, err=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>)
Main control flow function used to encapsulate initialisation. the whole operation lives here π«Ά
β¨ torrentinfo.start_line(config, prefix, depth, postfix='', format_spec=1)
Print the first line during information output.
- Parameters
config(Config) β configuration object to use in this methodprefix(str) β prefix to insert in front of the linedepth(int) β indentation depthpostfix(str) β postfix to insert at the back of the lineformat_spec(int) β default colour to use for the text
π torrentinfo.top(config, torrent)
Prints out the top file/directory name as well as torrent file name.
- Parameters
config(Config) β configuration object to use in this methodtorrent(Torrent) β torrent instance to use for information
π AUTHOR π
Mateusz Kowalczyk
π COPYRIGHT π
Okay bestie, here's the legal bit β short and sweet, just how we like it:
2013, Mateusz Kowalczyk
That's it. That's the whole thing. 2013, Mateusz Kowalczyk β the copyright line, copied exactly, no cap. π Like, respect the author's year and name, fr fr. Don't be weird about it.
And that's a wrap on TORRENTINFO(1), bestie!! π¦ You just read the whole thing β this is version 1.8 of the page, dated __DATE__ (yes, the date's a placeholder, the build fills it in, don't come for me π). Go forth, check your torrents, and slay. π
β¨ periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: torrentinfo 1.8.7-bp160.2.1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms