|
| 1 | +# torreadwrite |
| 2 | + |
| 3 | +Utilities `torread` for decoding and `torwrite` for encoding `.torrent` files in `bencode`. |
| 4 | + |
| 5 | +| VL-LUG | | |
| 6 | +| --- | --- | |
| 7 | +| XMPP: | <xmpp:[email protected]> | |
| 8 | +| URL: | http://www.linuxdv.org/wiki/projects/torrents_editor | |
| 9 | +| SRC: | http://linuxdv.ru/forum/download/file.php?id=28 | |
| 10 | + |
| 11 | + |
| 12 | +### BUILD |
| 13 | + |
| 14 | +```shell |
| 15 | +$ make |
| 16 | +``` |
| 17 | + |
| 18 | +### INSTALL |
| 19 | + |
| 20 | +```shell |
| 21 | +$ sudo cp torread torwrite /usr/bin |
| 22 | +$ sudo cp torreadwrite.1.gz /usr/share/man/man1 |
| 23 | +$ sudo ln -s /usr/share/man/man1/torreadwrite.1.gz /usr/share/man/man1/torread.1.gz |
| 24 | +$ sudo ln -s /usr/share/man/man1/torreadwrite.1.gz /usr/share/man/man1/torwrite.1.gz |
| 25 | +``` |
| 26 | + |
| 27 | +### SAMPLE |
| 28 | + |
| 29 | +```shell |
| 30 | +$ torread samplefile.torrent > samplefile.torrent.txt |
| 31 | +$ nano samplefile.torrent.txt |
| 32 | + |
| 33 | +$ torwrite samplefile.torrent.txt > samplefile.mod.torrent |
| 34 | +``` |
| 35 | + |
| 36 | +### STRUCTURE |
| 37 | + |
| 38 | +#### Content torrent file |
| 39 | + |
| 40 | +Content torrent file is encoded as described above. Himself torrent file is bencoded dictionary with the following keys: |
| 41 | + |
| 42 | +* **info**: a dictionary describing the files in the torrent. There are two forms of the dictionary, the first to the torrent that contains only one file, and the second - for multi file torrent. |
| 43 | +* **announce**: string with a URL of the tracker. |
| 44 | +* **announce-list**: (optional) list of lists, each of which contains a string with a URL of the tracker. |
| 45 | +* **creation date**: (optional) integer - the creation of a torrent in seconds era UNIX (number of seconds since 00:00:00 01/01/1970). |
| 46 | +* **comment**: (optional) string with an arbitrary comment. |
| 47 | +* **created by**: (optional) string with the name and version of the created torrent file program. |
| 48 | +* **encoding**: (optional) any string of unknown purpose. |
| 49 | + |
| 50 | +In beztrekernom torrent announce and no announce-list, but instead there is an element nodes, which is a list of lists, each of which contains a line with the address and the number of nodes - the port number. Something like nodes = `[["<host>", <port>], [«<host>», <port>], ...]`. The simplest option - nodes = `[["127.0.0.1", 6881]]`. |
| 51 | + |
| 52 | +#### Dictionary info |
| 53 | + |
| 54 | +_The parameters are the same for single-file and multi-file torrents_. |
| 55 | + |
| 56 | +* **piece length**: number of bytes in a piece, usually a power of two. |
| 57 | +* **pieces**: a string of united 20-byte SHA1 hash pieces. |
| 58 | +* **private**: (optional) number. If it is one, the customer to search for peers to be used only tracker (s) specified in the torrent file. If this number is zero, the customer can add peers any methods: manually, or via DHT and Peer Exchange t. D. |
| 59 | + |
| 60 | +_For single file torrents_: |
| 61 | + |
| 62 | +* **name**: string filename. |
| 63 | +* **length**: the number of bytes in the file. |
| 64 | +* **md5sum**: (optional) string MD5 sums file. Fucking useless. |
| 65 | + |
| 66 | +_For multi file torrent_: |
| 67 | + |
| 68 | +* **name**: string with the name of the directory where all files will be placed. |
| 69 | +* **files**: a list of dictionaries, one for each file. Each dictionary contains the following keys: |
| 70 | +* **length**: the number of bytes in the file. |
| 71 | +* **md5sum**: (optional) string MD5 sums file. Fuck no one needs, as in the previous case. |
| 72 | +* **path**: a list of one or more lines, representing together a file path. The last line - the name of the file, the previous - the sequence of nested directories. For example, the path `dir1/dir2/file.ext` will be presented in a list of three lines: `dir1`, `dir2`, `file.ext`. |
0 commit comments