Closed foxi69 closed 4 years ago
Well, it is possible, though not directly, but with some shell magic.
Basically, you should do the following steps:
qbt torrent pause
one by one.For powershell
you can use something like that:
(qbt torrent list -c MyCategory -F json | ConvertFrom-Json).hash | foreach { qbt torrent resume $_ }
In bash
it is easier to use CSV format as you can use awk
to extract the hash. You can use the following script:
qbt torrent list -c MyCategory -F csv | awk -F "," 'NR > 1 {print $1}' | xargs -n 1 qbt torrent pause
I will probably add some additional output formats in the next qbt
versions to make similar scenarios easier.
Oh thanks.
Can u help me how can i make a script what pause the torrent and unrar after downloaded + delete the rar files after unrar complete :|
Like this one: cmd /c timeout /t 15 & "E:\Programok\WinRAR\RAR.exe" x -r "%F*.rar" "%F" && del /f "%F*.r'[0-9]{2}'" && del /f "%F*.sfv*"
but i dont know how to open powershell in the background to pause first :/
In order to run a command in powershell you can use the following:
powershell -Command "<command>"
So, if I correctly understand what you'd like to achieve, you can use something like that:
powershell -Command "(qbt torrent list -c MyCategory -F json | ConvertFrom-Json).hash | foreach { qbt torrent resume $_ }" && cmd /c timeout /t 15 & "E:\Programok\WinRAR\RAR.exe" x -r "%F*.rar" "%F" && del /f "%F*.r'[0-9]{2}'" && del /f "%F*.sfv*"
Works with a batch file what i run from qBitorrent :)
\RUN.bat "%I" "%F"
powershell -Command "(qbt torrent list --url http://localhost:8080 -c MyCategory -F json | ConvertFrom-Json).hash | foreach { qbt torrent pause $_ --url http://localhost:8080 }" && cmd /c timeout /t 15 & "E:\Programok\WinRAR\RAR.exe" x -r "%2*.rar" "%2" && del /f "%2*.r" && del /f "%2*.sfv"
I wanted to pause the torrent what downloaded already, but with this code it will stop every torrent in the specified category after one torrent downloaded in that category :/
After it unrar the torrent, how can i delete only the rar,r01....r99 files? :)
powershell Get-ChildItem $Path | Where{$_.Name -Match "*.r[0-9]{2}"} | Remove-Item it doesnt work :(
I have been created my own script with Powershell and works great with your program :) Thanks @fedarovich
Like qbt torrent pause ALL -c CategoryName
does it possible?