qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.67k stars 4.01k forks source link

delay option for running external program #10206

Open aburke20 opened 5 years ago

aburke20 commented 5 years ago

qBittorrent version and Operating System

4.1.5; Win 10

What is the problem

I'm trying to get Filebot to run after a torrent has finished. The issue I initially had was that of course I asked the torrents to "recheck" upon completion, which stopped Filebot from being able to move and delete the torrent (as it was still being checked).

I then gave up and stopped the torrent check upon completion, and that solved the issue for about half my torrents, but there are still half that get caught up in seeding for a few seconds and again will not be processed by Filebot, as the torrent is "being used" by Qbit.

What is the expected behavior

The best case scenario, which I have been desperately trying to get to work for days now is that the "run external program" waits 10-15 seconds before launching Filebot, and I think all these issues would vanish, as the torrent would be free from Qbit.

Steps to reproduce

cmd /c START /MIN filebot -script fn:amc --output "U:\SERIES" --action copy --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=n artwork=n clean=y "ut_dir=%F" "ut_kind=multi" "ut_title=%N" "ut_label=%L"

Extra info(if any)

Is there any way to maybe add some code to the begining of my script above to get the same "delayed" result ?

I've tried adding SLEEP 10 pinghost -n 10 timeout /t 10

I don't really know what I'm doing, so might be an easy fix, but Google has given me nothing.

Supralateral commented 5 years ago

Write a batch script (.bat file) to 1) sleep (timeout 10) and 2) call filebot

Use qBittorrent to run the bat file, use the bat file to run filebot

Lux-Hue commented 5 years ago

The way I am handling that personally is the following (keep in mind, I am almost certain there are more simple and cleaner ways to handle this, but this is what I figured out and it works):

In qBittorrent, I run this when a torrent completes: D:\Downloads\Series\CleanupScript.vbs

CleanupScript.vbs has the following code: Dim WinScriptHost Set WinScriptHost = CreateObject("WScript.Shell") WinScriptHost.Run "D:\Downloads\Series\CleanupScript.bat", 0 (the 0 means it won't have a window) Set WinScriptHost = Nothing

(The reason why I don't simply run the batch file is because I didn't want to be interrupted by a cmd window popping up, and that was the fix that I found.)

In CleanupScript.bat, I have the following: cd /d D:\Downloads\Series\ TIMEOUT /t 10 /nobreak an example Filebot line: FOR %%I IN (*"overlord iii"*) DO filebot -rename "%%I" --db thetvdb -non-strict --q "overlord" --filter "s == 3" --format "E:/Series and Anime/{n}/{n} - {s00e00} - {t}" and then all the code for running filebot and refreshing the relevant plex library. "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 2

I found that 10 seconds was enough, since I don't do any rechecking, but you can change the length to any arbitrary amount. Hope this can be useful to you (or others with the same question).

luzpaz commented 1 year ago

Related to #18457