Archived

This topic is now archived and is closed to further replies.

xuxaki

Download complete notification (plugin?)

Recommended Posts

Hi!

I have a server at home, and i want to notify by e-mail, popup, php script, whatever when a download is complete.

My uTorrent version is 1.7.7.

Do i have some way to do this?

Thanks

Share this post


Link to post
Share on other sites

Thanks for the link!

By the command line that works perfectly! But across uTorrent that doesn't work! And that's because uTorrent grab only the first token and execute him, i.e.:

My full command is:

C:\sendEmail-v155\sendEmail -t mymail@gmail.com -u Download: %N -m File stored on: %D -f mynick@iol.pt -s smtp.iol.pt:25 -xu mynick -xp mypass

But uTorrent pick ONLY C:\sendEmail-v155\sendEmail and execute that!

There is no way to "tell" uTorrent to execute the FULL line and not only the firt token? I already try to add ' at the begin & end of the command, but nothing happens...

Thanks

Share this post


Link to post
Share on other sites

SOLVED!

instead of execute directly the sendmail command on uTorrent (which is quite large), i've created a .bat file that received and parse the parameters (separated by @) I want from uTorrent and send the email. Give you the code of my execute.bat file, that can help someone in the future :):

@echo off

SET input=
SET name=:

:Main
if /i "%1"=="" goto :ExitBatch
IF "%1"=="@" GOTO NewString
IF "%1"=="-" GOTO Pass
SET temp=%1
SET input=%input% %temp%
shift
goto :Main

:NewString
SET name=%name% %input%
SET input=
shift
GOTO Main

:Pass
shift
GOTO Main

:ExitBatch
C:\sendEmail-v155\sendEmail -t mymail@gmail.com -u Download completed: %name% -m Download directory: %input% -f mynick@domain.com -s smtp.domain.com:25 -xu mynick -xp mypassword

On uTorrent simply put the following code:

C:\sendEmail-v155\execute.bat %N @ %D

Share this post


Link to post
Share on other sites

I used the WebUI API as a workaround, not my best coding ever but a quick fix. It does stop completed downloads however in order to only alert you once.

Run the PHP script below in cron (works from remote server):

<?php

$webUI_url = "URL";

$webUI_port = PORT;

$webUI_user = "USER";

$webUI_pass = "PASS";

$emailto="to@email.com";

$headers = "From: from@email.com";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://$webUI_url:$webUI_port/gui/?list=1" );

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_USERPWD, "$webUI_user:$webUI_pass");

if ( $response = curl_exec( $ch ) ) {

//echo $response;

$obj = json_decode($response,true);

$torrents = $obj['torrents'];

//echo count($torrents,0);

//print_r($torrents);

$arrsize = count($torrents);

for ($i=0; $i<$arrsize; $i++)

{

if (($torrents[$i][4] == 1000) && ($torrents[$i][1] == 200)) {

echo $torrents[$i][0];

curl_setopt($ch, CURLOPT_URL, "http://$webUI_url:$webUI_port/gui/?action=stop&hash=".$torrents[$i][0]);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_USERPWD, "$webUI_user:$webUI_pass");

if ( $responsestop = curl_exec( $ch ) ) {

if ($responsestop != "invalid request") {

$name = $torrents[$i][2];

$label = $torrents[$i][11];

$subject = "Download completed: " . $name;

$txt = "Name: " . $name . "\r\n" .

"Label: " . $label;

mail($emailto,$subject,$txt,$headers);

}

}

}

}

}

else {

echo 'Server not found';

}

curl_close($ch);

?>

Share this post


Link to post
Share on other sites