Feature Request: Ability to pipe std out into deluge-console

Suggestions and discussion of future versions
Post Reply
james_h143
New User
New User
Posts: 2
Joined: Thu Jun 17, 2021 10:27 am

Feature Request: Ability to pipe std out into deluge-console

Post by james_h143 »

In deluge-console i would like to be able to pipe stuff in

e.g. i can get a list of torrent IDs with the following command:

Code: Select all

deluge-console info | grep -i ID: | sed -e 's/\ID: //g'
i would like to be able to pipe this into deluge-console commands e.g. del

i did try it:

Code: Select all

user@host:~$ deluge-console info | grep -i ID: | sed -e 's/\ID: //g'
ae649736f1c58de4e8b1bfd0bdeff8342dc1f5cd
ae92eb6c9b940eb86655e17e13154ba9749cf145
92886ee075f8f7c27c8b9303e1c7e204e1b68abc
b3ba0bf8fc3f846202af1a0aecd9192cc18a6c58
6ff0dad830226464df1504362aba2c838ca64182
b8d0585a65de0596ca0559bc495797ed3fafb6a9
5abd0b743222dadb5811aa1ae1baacc2dc2b8db7
75c5deb3d01ff49f2626fd4a28f531bbd37cc988
6b7dd2a76788e2ddb6eddaf9428f1ba389abdb72
8dae331004c0131c96f3b6bbef95799c7ce6170a
user@host:~$ deluge-console info | grep -i ID: | sed -e 's/\ID: //g' | deluge-console del
Usage: rm <torrent-id>
could be useful for pausing and resuming all torrents too e.g. if i wanted to create a cron job for only having them active when i'm asleep or something

if someone knows of another way to do something to this effect i would be interested in knowing
mhertz
Moderator
Moderator
Posts: 1189
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Feature Request: Ability to pipe std out into deluge-console

Post by mhertz »

You could write a shell-function/script, e.g. this one-liner where you give command and match as args, but made very quickly so could be better, like e.g. append '--confirm' whenever 'rm' command given, so you don't have specify that yourself after the 'rm' etc - you have to quote currently if using --confirm, so "rm --confirm", and if wanting processing all, then don't add anything for match after command, and for partial-match then add some chars from wherever in name and no asterisk, but you can though use one or two asterisks if wanted, but then just need quoting the match given - very quickly made as said :) :

Code: Select all

deluge-console "info -v" | grep Name: | cut -c7- | egrep "$2" | while read line; do deluge-console $1  $line; done
However, you could just as well use the built-in functionality, so e.g.

Code: Select all

deluge-console "rm/pause/resume/move *"
Or:

Code: Select all

deluge-console "rm/pause/resume/move arch*"
Or:

Code: Select all

deluge-console "rm/pause/resume/move *linux*"
Remember with rm/del use '--confirm' instead of '-c' because of bug not fixed yet, with overlapping args.

Edit: Just realized you're on deluge1 from the way you express the args, so somethings slightly different, e.g. no move command I believe, and I believe it only globs from beginning of torrent-name, and I used no asterisk for partial matches on deluge1 I remember, as worked anyway(e.g. 'a' for archlinux*), in contrary to deluge2 where specifically is needed to work(and can glob backwards also), but cannot 100% remember, so take with grain of salt. I believe '*' was supported for all torrents on deluge1 too, but you have to test yourself.
james_h143
New User
New User
Posts: 2
Joined: Thu Jun 17, 2021 10:27 am

Re: Feature Request: Ability to pipe std out into deluge-console

Post by james_h143 »

Nice, this works thanks
Post Reply