Programmer guide
How the source code of bittorrent-tracker-editor works. Read this before you change the code: it saves you the time to study the inner working.
The program is written in Free Pascal with the Lazarus LCL (ObjFPC mode, UTF-8 strings). All the code is in source/code/.
Suggested reading order
- Architecture: the three executables, every unit, and the
usesgraph. Start here. - Torrent file format:
bencode.pasanddecodetorrent.pas. - Tracker pipeline:
TTrackerList,CombineFiveTrackerListToOneandupdate_torrent.pas. This is the heart of the program. - Console mode:
main_common.pas,main_cli.pas, argument decoding, exit codes. - GUI:
main.pas,main.lfmand the three controllers. - Online services: newTrackon, ngosang, tracker status, OpenSSL.
- Build and test: Makefile, lazbuild, FPCUnit, WSL, CI.
- Conventions and design decisions: style rules and the known (accepted) minor issues.
- Maintaining this documentation: how the site is built and which file must be kept in sync with which.
The ten second summary
flowchart LR
A[".torrent files"] -->|decode| B["TDecodeTorrent<br/>(bencode tree)"]
B -->|trackers inside| C["TTrackerList<br/>lists of trackers"]
D["add_trackers.txt<br/>or memo in GUI"] --> C
E["remove_trackers.txt<br/>or unchecked rows in GUI"] --> C
C -->|"CombineFiveTrackerListToOne<br/>(-U0 .. -U7)"| F["TrackerFinalList"]
F -->|"UpdateTorrentFileList"| G["modified .torrent files<br/>(temp file + rename)"]
F --> H["export_trackers.txt"]