Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qbittorrent 4.0.4 not running external program on torrent completion #8454

Closed
JourneyOver opened this issue Feb 19, 2018 · 38 comments
Closed

Comments

@JourneyOver
Copy link

Please provide the following information

qBittorrent version and Operating System

qbit version: 4.0.4
OS Version: Windows 10 x64 latest Fall Creator Updates

What is the problem

Upgraded to qbit 4.0.4 and now qbit no longer runs external programs on torrent completion.

What is the expected behavior

for qbit to run external programs on torrent completion.

Steps to reproduce

  1. Have something in "run external programs on torrent completion"
  2. Download torrent
  3. wait for completion
  4. watch as it doesn't execute anything after completion
  5. ???

Extra info(if any)

When I downgraded back to 4.0.3 things work as expected, so this is an issue with something in 4.0.4

@cr8tor456
Copy link

cr8tor456 commented Feb 19, 2018

Same here...
Same OS, QBitorrent version. Same work-around is effective.

@strotee
Copy link

strotee commented Feb 19, 2018

similar to #8420

I personally upgraded to 4.04 and it works. I'm curious, what type of program runs after downloads complete? I have a .bat/.cmd and it works fine. What's the full command that you're trying to run?

@JourneyOver
Copy link
Author

Hmm I tried searching to see if an issue was already up but couldn't find one >.<

I myself am running a python script with the command just being
"C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"
and it pretty much does exactly the same as @marcmv1 post on #8420 where it says "running external program blah blah blah" after the torrent is complete but never actually does unless I downgrade to qbit 4.0.3

@cr8tor456
Copy link

cr8tor456 commented Feb 19, 2018

Im running the same command as JourneyOver short of the file location...

"D:\utorrent-postprocess.pyw" "%L" "" "%N" "multi" "" "%F"

Here is a log output from each version on the same file. (they are identical)
4.0.3
(N) 2018-02-19T16:09:29 - Torrent: Robot.Chicken.S09E08.Ext.Forest-Day.720p.AMZN.WEBRip.DDP5.1.H.264-NTb, running external program, command: &quot;D:/utorrent-postprocess.pyw&quot; &quot;&quot; &quot;&quot; &quot;Robot.Chicken.S09E08.Ext.Forest-Day.720p.AMZN.WEBRip.DDP5.1.H.264-NTb&quot; &quot;multi&quot; &quot;&quot; &quot;T:\Robot.Chicken.S09E08.Ext.Forest-Day.720p.AMZN.WEBRip.DDP5.1.H.264-NTb&quot;
4.0.4
(N) 2018-02-19T16:14:58 - Torrent: Robot.Chicken.S09E08.Ext.Forest-Day.720p.AMZN.WEBRip.DDP5.1.H.264-NTb, running external program, command: &quot;D:/utorrent-postprocess.pyw&quot; &quot;&quot; &quot;&quot; &quot;Robot.Chicken.S09E08.Ext.Forest-Day.720p.AMZN.WEBRip.DDP5.1.H.264-NTb&quot; &quot;multi&quot; &quot;&quot; &quot;T:\Robot.Chicken.S09E08.Ext.Forest-Day.720p.AMZN.WEBRip.DDP5.1.H.264-NTb&quot;

Edit: Also, I can switch back and forth between versions with reinstalls and the issue follows 4.0.4

@JourneyOver
Copy link
Author

It makes me wonder if 4.0.4 is just not playing nice with python then, as so far that's the only pattern that I am seeing between myself, @cr8tor456 and @marcmv1

@cr8tor456
Copy link

I suspect its related to this change
WINDOWS: Revert "Run external program" function. Now you will not be able to directly run batch scripts. (Chocobo1)
As far as i can tell that comes from here: #7878

Not sure where to go from here...

@FranciscoPombal
Copy link
Member

@cr8tor456 Delete all files related to qBittorrent, including settings files in %appdata% directory when reinstalling qBittorrent. Then, downgrading to 4.0.3 to fix the issue.
@JourneyOver related PR that is expected to fix this #8441

@cr8tor456
Copy link

cr8tor456 commented Feb 19, 2018

@FranciscoPombal Are you asking me if i did this? I did not. I ran the install for named version and let it uninstall previous version.

Works with 4.0.3, not with 4.0.4. I can switch back and forth by reinstalling whichever version (with uninstalling the other version) and the issue follows 4.0.4
And yes i am currently on 4.0.3 with it working.

@FranciscoPombal
Copy link
Member

@cr8tor456 I thought you meant that downgrading to 4.0.3 did not fix your issue. The aim of my comment above was to provide a solution for that case.

@cr8tor456
Copy link

cr8tor456 commented Feb 19, 2018

@FranciscoPombal Understood! My bad if i was confusing with that part previously. :-)

To clarify i did not have to delete any files or do anything other than run the 4.0.3 install file and allow it to uninstall "the previous version detected" in order to regain functionality with 4.0.3

@FranciscoPombal
Copy link
Member

@cr8tor456 Ok, I suggested deleting those files just in case they had been left behind.

Anyhow, as my comment above states, this issue should be fixed in the next version (4.0.5) via merging of #8441. Until then, sadly, the only workaround seems to be downgrading to 4.0.3

@cr8tor456
Copy link

@FranciscoPombal Understood, thanks for the info. I can just hold off on 4.0.4 and watch for 4.0.5 then.

@JourneyOver
Copy link
Author

Thanks for the info @FranciscoPombal ^^

@Rafa-and
Copy link

Hi,

As far as I have seen, external program is executed (in my case, I execute a batch including all the parameters), but parameters are not in order:
From dir, "%D" = 3 ?
Counter, "%C" = 840365332
In v4.0.3 it was working fine.

@Agger84
Copy link

Agger84 commented Feb 21, 2018

Same here, I recently migrated from 2.21 and was hoping the run external program feature would work the same way. Im trying to run a batch script that converts my flacs to apple lossless upon completion. The execution log says the script was launched, but nothing actually happened. (if copy the command from the execution log it runs perfectly)

@ghost
Copy link

ghost commented Feb 27, 2018

How can I execute a batch script? The following works neither in 4.0.3, nor in 4.0.4:

C:\Windows\System32\cmd.exe /C "pause"

@cr8tor456
Copy link

cr8tor456 commented Feb 27, 2018

You would need to run c:\dosomething.bat

dosomething.bat would contain line/code that you want to execute such as

pause

@ghost
Copy link

ghost commented Feb 27, 2018

I tried that first of course, and it does work. What threw me off was that no window pops up, so I assumed it didn't run. Thanks!

@fabionar
Copy link

fabionar commented Mar 1, 2018

I'm having the same issue.

@leotimus
Copy link

got the same issue on Ubuntu 16.04 :(

@JourneyOver
Copy link
Author

JourneyOver commented Mar 30, 2018

So I tested building the latest master branch since #8441 had been merged into master, and to my disappointment "run external programs on torrent completion" still does not want to work.

Running the same command as before "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F" with the same outcome of it saying (N) 2018-03-30T07:56:14 - Torrent: Ferdinand (2017) -jlw, running external program, command: &quot;C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/Filebot_Wrapper.pyw&quot; &quot;&quot; &quot;&quot; &quot;Ferdinand (2017) -jlw&quot; &quot;multi&quot; &quot;&quot; &quot;C:\Users\JourneyOver\Desktop\QBT\Ferdinand (2017) -jlw\Ferdinand (2017).mkv&quot; but it never actually does anything.

@Chocobo1
Copy link
Member

@JourneyOver

Running the same command as before "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"

You should insert <full path here>\python.exe as the first command (I mean before your script).
Also try re-inputting the command as I see backslashes are still replaced by forward slashes, which shouldn't happen in current git master.

@JourneyOver
Copy link
Author

JourneyOver commented Mar 31, 2018

@Chocobo1 Okay so I just tried that method, along with trying pythonw.exe path (which is what my script is supposed to use as it's a python windowless) and then no python.exe path again since I re-input the command (which fixed the backslashes at least), but still it goes and says "running external program" and yet does nothing.

"C:\tools\python3\python.exe" "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"
produces
(N) 2018-03-30T19:04:31 - Torrent: The.Titan.2018.720p.HDRip.X264.AC3-EVO, running external program, command: &quot;C:\tools\python3\python.exe&quot; &quot;C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw&quot; &quot;&quot; &quot;&quot; &quot;The.Titan.2018.720p.HDRip.X264.AC3-EVO&quot; &quot;multi&quot; &quot;&quot; &quot;C:\Users\JourneyOver\Desktop\QBT\The.Titan.2018.720p.HDRip.X264.AC3-EVO&quot;
but nothing happens.

"C:\tools\python3\pythonw.exe" "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"
produces
(N) 2018-03-30T19:00:05 - Torrent: The.Titan.2018.720p.HDRip.X264.AC3-EVO, running external program, command: &quot;C:\tools\python3\pythonw.exe&quot; &quot;C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw&quot; &quot;&quot; &quot;&quot; &quot;The.Titan.2018.720p.HDRip.X264.AC3-EVO&quot; &quot;multi&quot; &quot;&quot; &quot;C:\Users\JourneyOver\Desktop\QBT\The.Titan.2018.720p.HDRip.X264.AC3-EVO&quot;
again nothing happens.

"C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"
produces
(N) 2018-03-30T19:07:27 - Torrent: The.Titan.2018.720p.HDRip.X264.AC3-EVO, running external program, command: &quot;C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw&quot; &quot;&quot; &quot;&quot; &quot;The.Titan.2018.720p.HDRip.X264.AC3-EVO&quot; &quot;multi&quot; &quot;&quot; &quot;C:\Users\JourneyOver\Desktop\QBT\The.Titan.2018.720p.HDRip.X264.AC3-EVO&quot;
and still nothing happens.

One way I know my script is working is that it's supposed to spit out a .log file from filebot when the command is run, yet running my command on 4.0.4 (and the 4.1.0alpha running on this commit ccc91e2 (which is the latest commit in the master branch) does not produce a log or do anything else on "running" the command)

Running 4.0.3 and below it doesn't matter if I insert the python path or not, it works regardless always runs the command/script and always spits out a .log file from filebot. So I know it's not my script that is at fault here.

Edit: Must of missed it the first time around but doing the normal "C:\tools\python3\python.exe" "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F" does produce something which may be helpful on the cause of this issue.

03-30-2018_19-32-40

as you can see it's throwing a "not enough values to unpack expected 6 but got 3" error.. I believe the script never threw this error on 4.0.3 and below as I've never seen it before and which is why it worked, but something must of changed in 4.0.4+ that has caused it to do this.

@Chocobo1
Copy link
Member

@JourneyOver
Please try PR #8669.

@JourneyOver
Copy link
Author

JourneyOver commented Mar 31, 2018

@Chocobo1 Looks like that fixes it, but it only works if I enter the path of pythonw.exe or python.exe like so "C:\tools\python3\pythonw.exe" "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F" instead of "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"

Why was it changed to require that? Not that I fully care, but it seems weird that 4.0.3 and below didn't require that bit.

@Chocobo1
Copy link
Member

Why was it changed to require that?

Because previously qbt prepended cmd.exe before users command (plus workarounds) but it still fails in some edge cases, so I opt to revert back to square one.
Also you might think your command is running in cmd.exe but in reality it is not, hence you won't be able to access python directly or any program in %PATH%.

@JourneyOver
Copy link
Author

JourneyOver commented Mar 31, 2018

@Chocobo1 Ah okay gotcha, anyways idk if this is another bug with qbittorrent or what but had a recent download go through but it seems to be making my script fail for some reason but it works on 4.0.3 just fine.

Torrent named Once Upon a Time S07E15 720p WEB x264-TBS downloaded and completed and sent the command from above, and from the qbittorrent logs it looked like it passed everything correctly, but upon inspection of my logs from filebot it seems that the directory was not passed correctly at all and resulted in the directory that was being passed in as C:\Users\JourneyOver\Desktop\QBT\Once.Upon.a.Time.S07E15.720p.WEB.x264-TBS?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????b even though when looking at the directory in my QBT folder, and even the logs for qbittorrent it showed it being passed as C:\Users\JourneyOver\Desktop\QBT\Once.Upon.a.Time.S07E15.720p.WEB.x264-TBS

When I tested the same download on qbittorrent 4.0.3 it passed everything correctly and I didn't have the same problem as above with the whole Once.Upon.a.Time.S07E15.720p.WEB.x264-TBS?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????b bit as it actually passed it off as C:\Users\JourneyOver\Desktop\QBT\Once.Upon.a.Time.S07E15.720p.WEB.x264-TBS

so far it's been the only one I can reproduce it on 100%, as any others I've downloaded has been passed through just fine on.Sadly I can't see myself sharing the .torrent though for you to test with (at least through here) as it's from a private tracker.

@JourneyOver
Copy link
Author

JourneyOver commented Apr 1, 2018

@Chocobo1 I'm calling bug with your pull request of qbittorrent 4.1.0alpha #8669 for the above issue, as I'm getting more .torrents running into the whole qbittorrent appending ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????b to the file path parameter.

Qbittorrent logs show

(N) 2018-04-01T01:54:39 - Torrent: Ash.vs.Evil.Dead.S03E06.720p.WEB.H264-DEFLATE, running external program, command: &quot;C:\tools\python3\pythonw.exe&quot; &quot;C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.pyw&quot; &quot;&quot; &quot;&quot; &quot;Ash.vs.Evil.Dead.S03E06.720p.WEB.H264-DEFLATE&quot; &quot;multi&quot; &quot;&quot; &quot;C:\Users\JourneyOver\Desktop\QBT\Ash.vs.Evil.Dead.S03E06.720p.WEB.H264-DEFLATE&quot;

but like before upon inspection of my scripts log it shows
Parameter: ut_dir = C:\Users\JourneyOver\Desktop\QBT\Ash.vs.Evil.Dead.S03E06.720p.WEB.H264-DEFLATE?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????b

Again this is only happening on the 4.1.0alpha from your pull request, if I downgrade back to my 4.3.0 release it never does this.

@Chocobo1
Copy link
Member

Chocobo1 commented Apr 1, 2018

Hmmm, hard to understand why that happens... let's try a simple python script first:

import sys

f = open('c:\\windows\\temp\\qbt_exec.txt', 'w')
argc = len(sys.argv)
f.write("number of arguments: " + str(argc) + "\n\n")
for i in range(argc):
	f.write(str(i + 1) + ": " + sys.argv[i] + '\n')
f.close()

Tell qbt to execute this script (for the specific torrent that exhibits the problem), after execution find the file "c:\windows\temp\qbt_exec.txt" and post it here.

@Chocobo1
Copy link
Member

Chocobo1 commented Apr 1, 2018

@JourneyOver
Just squashed a related bug, I've updated that PR, please try again.

Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Apr 1, 2018
Need to split arguments manually because QProcess::startDetached(QString)
will strip off empty parameters.
E.g. `python.exe "1" "" "3"` will become `python.exe "1" "3"`.
Closes qbittorrent#8454.
@JourneyOver
Copy link
Author

JourneyOver commented Apr 1, 2018

@Chocobo1 before I update to the next commit here is the qbt_Exec.txt file.

qbt_exec.txt
and for some reason I see this error as well.
04-01-2018_05-30-56

That's running "C:\tools\python3\python.exe" "C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper.py" "%L" "" "%N" "multi" "" "%F"

now I will go about getting the latest commit built and test it.

@JourneyOver
Copy link
Author

@Chocobo1 running latest commit of the PR seems to have fixed the issue possibly (I'm still going to keep an eye on things over the next day or two), it at least passes all the arguments now going by what the qbt_exec.txt says

qbt_exec.txt
and the error didn't pop up like the above screenshot.

ontop of that I tested using my normal script and it doesn't go and fail either, as it actually passes the directory like so now
Parameter: ut_dir = C:\Users\JourneyOver\Desktop\QBT\Ash.vs.Evil.Dead.S03E06.720p.WEB.H264-DEFLATE

@Chocobo1
Copy link
Member

Chocobo1 commented Apr 3, 2018

I've merged the fix to git master now, closing issue.

For others:
Will be fixed in next release (v4.0.5).

@JourneyOver
Copy link
Author

Great! so far everything seems to be running just fine on the 4.1.0Alpha.

@blakeusblade
Copy link

Workaround here

#7800

@JourneyOver
Copy link
Author

@blakeusblade this has already been fixed a while back, people just need to wait for the next release or build the latest commits themselves until the next release.

@creptt
Copy link

creptt commented May 3, 2020

Solution for MacOS or Linux/Debian users.... I created a wtf.sh script and it is located in my /Users/sean/QBittorent/ directory. Thus I gave the qbittorrent client the following path to execute the my shell script: /Users/sean/QBittorrent/wtf.sh. The wtf.sh script contains only the following (4) lines.
don't forget to give your shell script reading/writing permission. write the following in your terminal for (MacOS or Linux/Debian) systems:
chmod 755 wtf.sh (that was the name of my script; replace with the script that you created).

#!/bin/bash

cd /Users/sean/QBittorrent/

echo yay >> debug.txt
echo yay2 >> debug.txt

It works now; however, In my previous attempts qBittorrent did not execute the wtf.sh script, once the torrent finished downloading. What I changed that made it work was adding line number 2 ("cd /Users/sean/QBittorrent/"), which tells the script when it's called to cd into the directory first, which seems bizarre considering that I gave the full path to the qBittorrent client.

Now can anyone tell me how to use the parameters and it what context might it be used (i.e. "%N" "%F" and etc...)?

@FranciscoPombal
Copy link
Member

FranciscoPombal commented May 3, 2020

@creptt please don't spam multiple closed threads, I already replied to you in #6019. This issue has been solved 2 years ago, you are just not using this feature right...

@qbittorrent qbittorrent locked as resolved and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests