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

Pause torrent with specified category #24

Closed
foxi69 opened this issue Dec 17, 2019 · 7 comments
Closed

Pause torrent with specified category #24

foxi69 opened this issue Dec 17, 2019 · 7 comments
Labels

Comments

@foxi69
Copy link

foxi69 commented Dec 17, 2019

Like qbt torrent pause ALL -c CategoryName

does it possible?

@fedarovich
Copy link
Owner

fedarovich commented Dec 17, 2019

Well, it is possible, though not directly, but with some shell magic.

Basically, you should do the following steps:

  1. Get the list of torrents filtered by category in some parceable format, e.g. JSON.
  2. Extract the torrent hashes from it.
  3. Pass the hashes to 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.

@foxi69
Copy link
Author

foxi69 commented Dec 17, 2019

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 :/

@fedarovich
Copy link
Owner

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*"

@foxi69
Copy link
Author

foxi69 commented Dec 18, 2019

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*"

@foxi69 foxi69 closed this as completed Dec 18, 2019
@foxi69
Copy link
Author

foxi69 commented Dec 19, 2019

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 :/

@foxi69 foxi69 reopened this Dec 19, 2019
@foxi69
Copy link
Author

foxi69 commented Dec 19, 2019

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 :(

@foxi69
Copy link
Author

foxi69 commented Dec 19, 2019

I have been created my own script with Powershell and works great with your program :)
Thanks @fedarovich

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants