Not able to set startup deluge-console server

General support for problems installing or using Deluge
Post Reply
chowbok
New User
New User
Posts: 3
Joined: Tue Jun 05, 2018 1:04 am

Not able to set startup deluge-console server

Post by chowbok »

I use deluge-console on my client computer to connect to a remote server. Whenever I start it, it attempts to connect to localhost and fails. I have to manually type in the connect command in the console every time. How can I get it to default to connect to the remote server?
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Not able to set startup deluge-console server

Post by mhertz »

I don't guess there's configuration for that, but honestly I don't know, however, if it was me, then i'd workaround this issue by adding an alias in my .bashrc/.zshrc, e.g.:

Code: Select all

delu='deluge console "connect host[:port] [user] [pass]"'
Or, I'd probably instead make a shell-function in said file(s):

Code: Select all

delu() {
deluge-console "connect host[:port] [user] [pass]; $@"
}
So you can e.g. run 'delu info' to get a list of all torrent currently loaded, on the terminal and exit the console-interface again, or just 'delu' to enter the console-interface connected(and stay there).
chowbok
New User
New User
Posts: 3
Joined: Tue Jun 05, 2018 1:04 am

Re: Not able to set startup deluge-console server

Post by chowbok »

Did you try that? Any command specified on the command line will execute but then it will disconnect you. So

Code: Select all

deluge-console "connect server user pass ; info"
will indeed get you a list of torrents, but if you just do

Code: Select all

deluge-console "connect server user pass"
it will connect to the server and then immediately disconnect again, leaving you back at a shell prompt.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Not able to set startup deluge-console server

Post by mhertz »

I apologize, no I haden't and did't knew that, sorry! :( That's annoying indeed! I always just connect to localhost on standard port and so with my shell-fucntion it works great i.e. 'delu' runs deluge-console and stays there, and e.g. 'delu info arch', gives status on torrent(s) matching *arch* in name and quits, and I was sure it had logic to separate out the 'connect' command specifically, but obviously not. Sorry again!
chowbok
New User
New User
Posts: 3
Joined: Tue Jun 05, 2018 1:04 am

Re: Not able to set startup deluge-console server

Post by chowbok »

No worries, I appreciate the thought. It seems like a bug that "connect" by itself doesn't leave you in the console; why would anyone want the current behavior?
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Not able to set startup deluge-console server

Post by mhertz »

Indeed! I just looked-up that back before 2012, I think the connect command worked like you(we/all!) wan't, but it didn't support adding any extra commands non-interactively through semicolons however, and then in v1.3.6 it was "fixed" because of a bug/feature-request (https://bugs.launchpad.net/ubuntu/+sour ... ug/1004793), so multiple commands could be used non-interactively, but the interactive part disappeared however. Then, 20 months ago, a feature-request was made referencing exactly your issue(and wanting to be able to make an alias with it), but it's not assigned/responded too unfortunetly: https://dev.deluge-torrent.org/ticket/2897

The gtk and web ui's both have means to auto-connect to specific host on statup through there config-files, but I didn't found any for the console unfortunetly :(

It would be a nice feature indeed. The new v2.0 beta's(from git develop branch, available in AUR as deluge-git) features a completely redesigned console-interface(pretty cool btw, though some buggy), which I don't know if works differently regarding this issue though.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Not able to set startup deluge-console server

Post by mhertz »

For people ONLY using deluge-console interactively with connect command, then here's a quick'n dirty patch I just whipped up, that simply changes one line's variable from false to true. Note, this isn't the proper way to do it and is a bad/dirty hack, but for people just requiring this functionality described in this post and don't care about other functionality breaking(non-interactive mode), then it's a choice available atleast. I don't code python so cannot make it better than this unfortunately, sorry. Note, made from latest stable deluge v1.3.15.

connect.diff:

Code: Select all

--- a/main.py	2017-12-16 03:34:59.000000000 +0100
+++ b/main.py	2018-06-08 22:51:03.208758597 +0200
@@ -162,7 +162,7 @@
         if args:
             # Multiple commands split by ";"
             commands = [arg.strip() for arg in ' '.join(args).split(';')]
-            self.interactive = False
+            self.interactive = True
 
         # Try to connect to the daemon (localhost by default)
         def on_connect(result):
You can also just manually change the file, since it's such a quick "fix", just like I did during testing this out(I first messed around with connect.py unsuccessfully, but then finally found a way, from main.py instead).

Anyway, the file to edit, or patch, is located on my system(arch linux) at: '/usr/lib/python2.7/site-packages/deluge/ui/console/main.py'

Well, the quickest I guess is to simply copy/paste this command-line into your terminal, but make sure deluged isn't running + change path if not the same as mine:

Code: Select all

sudo sed -i 's/self.interactive = False/self.interactive = True/' /usr/lib/python2.7/site-packages/deluge/ui/console/main.py
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Not able to set startup deluge-console server

Post by mhertz »

... Just for others possibly finding this thread in a google search, then here's another "patch" which is better than the previous posted one, in specific scenario.

For people always connecting to the same host through deluge-connect, then the following command-line will fix this threads reported issue, without breaking anything(non-interactive still works) and the added benefit of not even needing to use connect anymore, as it always will auto-connect to defined host, no matter if running interactive or non-interactively.

Change the path to match yours + HOST, PORT, USER and PASSWORD:

Code: Select all

sudo sed -i 's/host="127.0.0.1:58846", username="", password=""/host="HOST:PORT", username="USER", password="PASSWORD"/' /usr/lib/python2.7/site-packages/deluge/ui/console/commands/connect.py
Post Reply