Setting incoming port based on script output.

General support for problems installing or using Deluge
Post Reply
cdysthe
Member
Member
Posts: 17
Joined: Sun Aug 09, 2009 2:07 pm

Setting incoming port based on script output.

Post by cdysthe »

Hi,

I have been using a script to find the forwarded port for my VPN provider. It uses the deluge-console command to do so and the port to use is the result of running another script which finds and outputs the port. It has worked well and I have run the script when a torrent is added using the execute plugin. The problem is that the output format from the script that finds the port now has changed and I am not able to find out how to get it to work with the new port output. The script is very simple:

#! /bin/bash
PORT=`/home/user/scripts/port.sh
deluge-console "config --set random_port False"
deluge-console "config --set listen_ports ($PORT $PORT)"

With the original port.sh script the output was simple, a port number like 34322. But the new port.sh script puts out the port in another format: {"port":34322}. How do I edit the script to be able to pick up the port number and pass it on to Deluge?
Kimiko
Member
Member
Posts: 13
Joined: Mon Jun 02, 2014 4:06 pm
Location: NL

Re: Setting incoming port based on script output.

Post by Kimiko »

Passing the output of port.sh through tr -d -c [:digit:] will remove all characters except digits.
cdysthe
Member
Member
Posts: 17
Joined: Sun Aug 09, 2009 2:07 pm

Re: Setting incoming port based on script output.

Post by cdysthe »

Thanks! I do not think I have enough script knowledge to make it work. I did get the correct port output from port.sh by using tr but I do not get the "deluge-console "config --set listen_ports ($PORT $PORT)"" line to pick up the output and pass it on to Deluge. If you have any idea how to make that work please let me know.
DenT
New User
New User
Posts: 1
Joined: Wed Feb 19, 2025 6:48 pm

Re: Setting incoming port based on script output.

Post by DenT »

I know this is an old thread, but I it found while looking for a similar answer.

Apparently the listen_ports is actually a range, not a single port. To set a range with deluge-console config, use [xxx,yyy]
so:
deluge-console config --set listen_ports [$PORT,$PORT]
Post Reply