It has to work in a sort of this way.
It downloads torrent file, scrapes out name, description, nfo file, category and
possibly other stuff, using Curl and regular expressions. It stores relevant data like info hashes and
file names in SQLite database for later use. Then torrent client (uTorrent/rTorrent) loads torrent file and starts downloading data. After download is complete, it executes upload function which, if needed, changes announce URL and uploads previously gathered data to your specified tracker, downloads newly generated torrent file, removes infohash checking from it (if using rTorrent on Linux) and adds to torrent client for seeding.
It also makes screenshots and adds it to the description.
something in the lines of this. but then for a couple of trackers.
[url removed, login to view]