Run external program on torrent completion hangs qbtitorrent

Windows specific questions, problems.
Post Reply
yog

Run external program on torrent completion hangs qbtitorrent

Post by yog »

System:
    windows 7 64bit - NTFS
    qBittorent 3.0.6

Test 1:
Run external program on torrent completion: D:\perl\test.bat
test.bat:

Code: Select all

@echo off
notepad.exe
pause
Result : After torrent is downloaded qbittorent hangs (program stops responding notifification)

Test 2:
Run external program on torrent completion: cmd.exe
Result : After torrent is downloaded qbittorent hangs (program stops responding notification)

Test 3:
Run external program on torrent completion: D:\perl\test.vbs
vbs:

Code: Select all

Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "notepad.exe", 1
Result : After torrent is downloaded qbittorent doesnt do anything with test.vbs (doesnt start notepad.exe)

Test 4:
Run texternal program on torrent completion:
notepad.exe

works fine

Question: is this a bug or am I doing something wrong ?
loki

Re: Run external program on torrent completion hangs qbtitorrent

Post by loki »

I don't think functionality of run on completion has the same capabilities as on linux. I think you can actually pass arguments to programs that you can run in linux. Are you trying to make it do something with the program you're trying to run, or just to open it?
yog

Re: Run external program on torrent completion hangs qbtitorrent

Post by yog »

hmm it seems that I forgot to mention why i'm doing this  :-\

I want to get msg on gtalk when torrent is finished, so I wrote simple perl script (it works fine outisde qb).

to run it i wrote in Run external program on torrent completion:

Code: Select all

 perl D:\perl\gimmesomeluv.pl [email protected] I just downloaded %n. How proud of me are you? ?
It didnt crash qb but did absolutly nothing
so my in my next steps i tried to do the same with cmd.exe, .bat, .vbs. which crash qb [tests in post #1].

So do am i doint smth wrong, or it's a bug ? Any workaround in mind ? Do i need to compile stuff to .exe do python instead perl ?
How to do this ?
Dayman

Re: Run external program on torrent completion hangs qbtitorrent

Post by Dayman »

This is a limitation of QProcess.
Reference code: https://github.com/qbittorrent/qBittorr ... .cpp#L2144
Possible solution from google:

Code: Select all

QProcess myProc;
QStringList Arg;
Arg << "/c mybat.bat";
myProc.startDetached("cmd.exe",Arg,Catalog);
myProc.waitForFinished();
[quote="loki"]
I don't think functionality of run on completion has the same capabilities as on linux. I think you can actually pass arguments to programs that you can run in linux. Are you trying to make it do something with the program you're trying to run, or just to open it?
[/quote]
Very true. Looks like any nonexcutables must be started from their corresponding programs.

P.S. Would be nice to actually have some kind of error handling here.
grimacester

Re: Run external program on torrent completion hangs qbtitorrent

Post by grimacester »

i have gotten mine to work so far (server 2008 r2):

in qbittorrent on external program completion (without quotes around the whole thing as shown): C:\full\path\here\test.bat "%f" "%n"

contents of test.bat:

echo Run on %date% at %time% >> "C:\full\path\here\testing.log"
echo testing no commands >> "C:\full\path\here\testing.log"
echo %~d1 >> "C:\full\path\here\testing.log"
echo %~p1 >> "C:\full\path\here\testing.log"
echo %~d1%~p1 >> "C:\full\path\here\testing.log"
echo %1 >> "C:\full\path\here\testing.log"
echo %2 >> "C:\full\path\here\testing.log"
echo %3 >> "C:\full\path\here\testing.log"
echo %4 >> "C:\full\path\here\testing.log"
echo %5 >> "C:\full\path\here\testing.log"
echo %6 >> "C:\full\path\here\testing.log"
exit

contents of the testing.log file that is created:

Run on Sun 11/18/2012 at  0:00:44.16
testing no commands
E:
\Completed\
E:\Completed\
E:/Completed/Other
"full name of torrent in quotes"
ECHO is on.
ECHO is on.
ECHO is on.
ECHO is on.

now i move on to testing with label being added... o fun...

hope that helps.
Post Reply