
Notification of downloaded torrents by SMS

Then, in my opinion, it came up with a good idea - why not make a notification about the downloaded torrent via SMS? You can then not bother at all with languid expectation and do your own thing. :)
Here's what came of it ...

Since I use the uTorrent torrent client, I have at my disposal a Web API through which you can receive information and manage all client settings. It is important to check the box Use the Web interface and the second box to allow guest access.

The Web API produces everything in json format, so there were practically no problems with parsing the dictionary. I was interested in torrents, which, of course, have not yet been downloaded. From all that is transmitted - we take the remaining time or percentage of completion (as you like), check it periodically, quite simply:
ss := TStringStream.Create('');
idhttp1.get('http://localhost:' + port +'/gui/token.html', ss);
token := ss.DataString;
token := copy(token, pos(';''>', token) + 3, length(token));
token := copy(token, 1, pos('<', token) - 1);
url := 'http://localhost:' + port + '/gui/?token=' + token +
'&list=1';
idhttp1.Get(url, ss);
* This source code was highlighted with Source Code Highlighter.
Next, we parse what the torrent gives out: What in reality looks like: Okay, we’ve got a list of torrents, we ’ll now have to send an SMS as well. I took the AvisoSMS library ready for this, by the way, it turned out to be quite simple to screw it on, I did not expect it. DLL reference
"torrents": [
[
ХЭШ (строка),
STATUS* (целое число),
ИМЯ (строка),
РАЗМЕР (целое число в байтах),
ПРОЦЕНТ ВЫПОЛНЕНИЯ (целое число на тысячу),
ЗАГРУЖЕНО (целое число в байтах),
РОЗДАНО (целое число в байтах),
...и так далее, смотрите лучше документацию, тут только кусочек.
{"build":19648,"label": ['#$A']'#$A',"torrents": ['#$A#$A'["08FAC4E006CBEB094D637849EC89023778BE7B55",201,"Patch",19257463,0,0,0,0,0,0,-1,"",0,11,0,0,0,1,19257463]]'#$A',"torrentc": "1014060939"}'#$A
login := Edit1.Text;
pass := Edit2.Text;
sAdress := Edit3.Text;
dAdress := Edit4.Text;
if (dAdress = '') then
dAdress := 'AvisoSMS';
SendMessage(Pchar(login), PChar(pass), PChar(dAdress), PChar(sAdress), PChar('Торрент ' + torName + ' закачан'));
* This source code was highlighted with Source Code Highlighter.
Testing on something lightweight ...

Hooray!

Resulting: Surprised by a cunning system of markers for security, but, I must say, in the case. Authorization is standard ... 401, so there were no problems with either the torrent API or SMS. It is written in CodeGear Rad Studio 2007. The interface, of course, is not so hot, but for the first time it will do. Ready to develop the program together with everyone, the source code and a working version below.
Sources: Download from Yandex.Disk
The working version in XP / Vista / 7: Download from Yandex.Disk
PS I would be grateful for an invite to the author of the article and this program - Oleg Tanasyuk. It is written specifically for Habr.