📜 ⬆️ ⬇️

We correspond with the torrent client

I wanted to somehow set up the ability to give a command to my home computer to start downloading a torrent by sending a torrent file by email to a special address, and when the download is finished, receive the corresponding notification by email. And did.

Additional conditions:

We will start the application scheduler from the user SYSTEM when the computer starts. To overcome the lack of a “correct” user and its directories, we will use the portable versions.

Take:
  1. To send emails with notifications blat.exe and stunnel ;
  2. uTorrent ;
  3. To receive emails with an attached Thunderbird file with attachmentextractor .

Customize:

1. blat.exe and stunnel


A notification about the end of the download will be sent from Gmail.
Required settings are described here .
Briefly:
1.1. Download the application, install stunnel.
1.2. Rule stunnel.conf in the stunnel folder.
')
# GLOBAL OPTIONS

client = yes
output = stunnel-log.txt
debug = 0
taskbar = no

# SERVICE-LEVEL OPTIONS

[SMTP Gmail]
accept = 127.0.0.1:1099
connect = smtp.gmail.com:465

1.3. In the command line we execute:
blat -install smtp.gmail.com youremail@gmail.com -u gmailusername -pw gmailpassword – - gmailsmtp

2. UTorrent


2.1. Install uTorrentPortable (tested on version 3.1.3), customize to your own needs, as well as in Settings:


2.2. In Task Scheduler, create a task to launch uTorrentPortable with the following settings:

Testing the start / end of uTorrentPortable from under SYSTEM showed that if it crashes, the PortableApps.comLauncherRuntimeData-uTorrentPortable.ini file remains in the uTorrentPortable \ Data \ folder, which makes it impossible to start the program again.

Therefore, in the “Actions” before launching uTorrentPortable, we add the launch of this clearini.bat:
set SETTINGSFILE="d:\uTorrentPortable\Data\PortableApps.comLauncherRuntimeData-uTorrentPortable.ini"
if exist %SETTINGSFILE% (del %SETTINGSFILE%) else (echo ok)


3. Thunderbird



3.1. Install Thunderbird portable
Clarification just in case: tested on thunderbird portable version 12.0
Customize the receipt of mail.
Install add attachmenttextractor .

In the attachmentextractor settings we specify:


3.2. Experiments on the launch of Thunderbird portable from under SYSTEM have revealed that the application still needs a temporary user folder.
Therefore, to start use the following Start.bat:

@echo off
setlocal enableextensions
set TMP=%~dp0temp-folder
"%~dp0ThunderbirdPortable.exe"
Endlocal


We save it in the folder with ThunderbirdPortable.exe and create the temp-folder folder there.

3.3. In the task scheduler we create the start.bat start task with the following settings:



4. Create a torrent_finish.bat



set debug=-debug -log blat.log -timestamp
"C:\Program Files\stunnel\stunnel.exe" -start -quiet
D:
CD D:\Soft\blat
blat.exe -p gmailsmtp -to youremail@gmail.com -subject "%~1" -body "Loaded." -charset windows-1251 -server 127.0.0.1:1099 %debug%
"C:\Program Files\stunnel\stunnel.exe" -stop -quiet


In uTorrent settings:
Advanced> Launch Program> Run This Program When The torrent_finish.bat "%N" > torrent_finish.bat "%N"

The system will be ready to work after each restart of the computer.

There are many other solutions that remotely control the torrent client. Here are 4 ways at once, and even special software here.

Source: https://habr.com/ru/post/144885/


All Articles