t-anc / GSP-Qbittorent-Gluetun-sync-port-mod

Docker mod for Linuxserver's Qbittorrent image to sync gluetun's forwarded port. Can also work with any qBittorrent image as a standalone container.
GNU General Public License v3.0
80 stars 5 forks source link

[FEATURE REQUEST] Change Port before start, with config file #13

Open olvier opened 1 month ago

olvier commented 1 month ago

Hi again ;)

TL;DR Do you see a chance, to change the port in the qbit-config-file, before the container starts? :)

In my own and old bash-script,

i double checked and changed the ports via API and also via config-file. So, when qbit starts, the port is already the right one.

Now, it first starts with the old (and now wrong) port, and then change it. At the tracker, the old (and now wrong) port is recorded at the beginning. Afterwards the tracker gets the new port, but is un-connectable for some time.

Do you see a chance, to change the port in the qbit-config-file, before the container starts? :)

Extract from my old own bash-script

sed -i "s/PortRangeMin.*/PortRangeMin=${X}/"  /volume1/docker/qbittorrent/movies_config/qBittorrent/qBittorrent.conf
sed -i "s/PortRangeMin.*/PortRangeMin=${Y}/"  /volume1/docker/qbittorrent/series_config/qBittorrent/qBittorrent.conf
t-anc commented 1 month ago

Hi again :) I really prefer the API way, specially since I introduced a standalone mode not running in the same container than qbittorrent. I remember thinking about adding an auto 'reannounce' after a port change, but I my memories Qbittorrent already re-announce to trackers after a port change. However I can't find where I saw that so maybe I'm wrong. In that case I can implement an API call after a port change to reannounce all torrents. Anyway, I'm not too keen about changing config files directly, I can't be sure the mod will run before qbt, and it needs quite a bit of changes in the code to implement this. I don't need this but I can leave this issue open and if enough people are interested I can take a look.

Do you know anything about qbt reannouncing after a port change ? Does an auto reannounce fit your need ? Thank you

olvier commented 3 weeks ago

Hi :)

I've tested re-announcing in qbit by hand, but it didnt changed anything. So i start with bad/wrong port and have to wait, that the tracker recognize the new and correct one. I edited my own script, that it edits the port in the conf, every minute. Maybe i could add some wait into the compose, to be sure that qbit starts with the correct port.