deluge-console problem getting information about the torrents

General support for problems installing or using Deluge
Post Reply
vasilev
New User
New User
Posts: 1
Joined: Tue Jul 25, 2023 6:27 pm

deluge-console problem getting information about the torrents

Post by vasilev »

Hello dear all,
I have been using Deluge for a few years.
After I have upgraded to version 2 and python3, I got problems getting the output from "deluge-console - info"
Here is my script:

Code: Select all

deluge-console "connect 127.0.0.1:58846; info; exit;" | grep ID | awk -F: '"'"'{print $2}'"'"' | tr -d " " | while read uuid; do echo deluge-console "connect 127.0.0.1:58846; info $uuid; exit "; done 
it was working before.
Now I get this error:
deluge-console "info; exit;"
Traceback (most recent call last):
File "/usr/bin/deluge-console", line 33, in <module>
sys.exit(load_entry_point('deluge==2.0.3', 'console_scripts', 'deluge-console')())
File "/usr/lib/python3/dist-packages/deluge/ui/console/__init__.py", line 19, in start
Console().start()
File "/usr/lib/python3/dist-packages/deluge/ui/console/console.py", line 153, in start
super(Console, self).start(self.console_parser)
File "/usr/lib/python3/dist-packages/deluge/ui/ui.py", line 66, in start
self.__options = self.parse_args(parser, args)
File "/usr/lib/python3/dist-packages/deluge/ui/ui.py", line 45, in parse_args
options = parser.parse_args(args)
File "/usr/lib/python3/dist-packages/deluge/ui/console/parser.py", line 76, in parse_args
multi_command = self._split_args(args)
File "/usr/lib/python3/dist-packages/deluge/ui/console/parser.py", line 55, in _split_args
cmd_options.command = cmds[0]
IndexError: list index out of range
Do you know what might be the problem and how to fix it?

thanks!


deluge-console 2.0.3
libtorrent: 1.2.9.0
Python: 3.9.2
OS: Linux Raspbian GNU/Linux 11 bullseye
mhertz
Moderator
Moderator
Posts: 2331
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: deluge-console problem getting information about the torrents

Post by mhertz »

There's an appended semi-colon after deluge's 'exit' command, breaking the arg-parsing in contrary to deluge1, and giving said error on deluge2. Btw, you don't need specify 'exit' as a given when in non-interactive(CLI) mode. Also, 'connect' isn't neither needed when using localhost and default port.

Anyway, you will get no output on deluge2 with that, as need add '-v' switch to deluge's 'info' command to get any 'ID' fields listed. Second, you have an 'echo' so just lists the deluge commands, which i'm assuming is a mistake, or just for testing maybe. Also, there's a mistake in the 'awk' command with the quoting, so breaks later parts - may I suggest replacing the 'awk' and 'tr' commands with a single 'cut -d ' ' -f2'. Though however I don't understand the point in this, as just running 'info -v' initially would do the same, no? I mean that command lists info on all IDs, and you instead filter each IDs out and run 'info' on them afterwards, sorry if going little more into your script than you asked for, just puzzled me.

Anyhow, that should work :)
Post Reply