Skip to content

Commit 7d4d06e

Browse files
committed
0.20230107: reformat description
1 parent 418cfcf commit 7d4d06e

File tree

5 files changed

+123
-72
lines changed

5 files changed

+123
-72
lines changed

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@ PACKAGE = torreadwrite
22
TARGETS = torread torwrite
33

44
CC = gcc
5-
LD = $(CC)
6-
CFLAGS =
5+
CFLAGS = -Wall
76
LDFLAGS = -s
87
SRCS = src
9-
RM = rm -fv
8+
RM = rm -f
109

1110
.PHONY: all clean
1211

1312
all: $(TARGETS)
1413

15-
torread: $(SRCS)/torread.c
16-
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
14+
torread: $(SRCS)/torread.o
15+
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
1716

18-
torwrite: $(SRCS)/torwrite.c
19-
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
17+
torwrite: $(SRCS)/torwrite.o
18+
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
19+
20+
%.o : %c
21+
$(CC) -c $(CFLAGS) $< -o $@
2022

2123
clean:
22-
$(RM) $(TARGETS)
24+
$(RM) $(SRCS)/*.o $(TARGETS)

README

Lines changed: 0 additions & 62 deletions
This file was deleted.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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`.

man/man1/torreadwrite.1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.TH torreadwrite "1" "0.20230107" "07 Jan 2023" "User Manual"
2+
3+
.SH NAME
4+
torread, torwrite
5+
6+
.SH DESCRIPTION
7+
Utilities \fItorread\fR for decoding and \fItorwrite\fR for encoding \fI.torrent\fR files in \fIbencode\fR.
8+
9+
.SH SYNOPSIS
10+
.PP
11+
.B torread
12+
file.torrent > file.txt
13+
.PP
14+
.B torwrite
15+
file.txt > file.torrent
16+
17+
.SH OPTIONS
18+
None.
19+
20+
.SH EXAMPLE
21+
.B torread
22+
samplefile.torrent > samplefile.torrent.txt
23+
.PP
24+
.B nano
25+
samplefile.torrent.txt
26+
.PP
27+
.B torwrite
28+
samplefile.torrent.txt > samplefile.mod.torrent
29+
30+
.SH COPYRIGHT
31+
This is free and unencumbered software released into the public domain.
32+
33+
.SH SEE ALSO
34+
ctorrent(1), aria2c(1), torrentcheck(7), torreadwrite(7)
35+
36+
.SH CONTACTS
37+
Website: https://github.com/Network-BEncode-inside/torreadwrite
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
.TH torreadwrite "1" "09 Jul 2015" "0.20150709" "User Manual"
2-
.PP
1+
.TH torreadwrite 7 "0.20230107" "07 Jan 2023" "Development Manual"
2+
3+
.SH NAME
4+
35
torreadwrite
46
.PP
57
VL-LUG

0 commit comments

Comments
 (0)