From 606e94fde2dbcd277c6617d996e46b24d51d1f3a Mon Sep 17 00:00:00 2001 From: splitsec2 <35583321+splitsec2@users.noreply.github.com> Date: Sat, 24 Oct 2026 09:15:55 -0600 Subject: [PATCH] fix(settings): offer the seed settings for qBittorrent only (#1574) The two seed settings, Give Up With No Seeders and Minimum Seeders, show up for every torrent client, but only qBittorrent reports a seed count. With Transmission, Deluge or rTorrent you can set both and nothing happens. The first one says "Only qBittorrent reports seed counts" at the end of its description, the second says nothing about it. Both are now shown only when qBittorrent is the selected client, the same `show_when` the other qBittorrent fields use, and Minimum Seeders gets the same sentence. A value someone already saved for another client stays in their config, it just is not shown, and it had no effect before either. `docs/environment-variables.md` is regenerated for the changed description, which is two lines. One test checks that both fields are tied to qBittorrent and say so, and it fails without the change. --- docs/environment-variables.md | 4 ++-- shelfmark/download/clients/settings.py | 9 ++++++--- tests/prowlarr/test_qbittorrent_settings.py | 12 ++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 75a49c31..a6624365 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -2340,7 +2340,7 @@ How long to keep cached search results before they expire. | `RTORRENT_DOWNLOAD_DIR_AUDIOBOOK` | Server-side directory where audiobook torrents are downloaded (optional, uses rTorrent default if not specified) | string | _none_ | | `PROWLARR_TORRENT_ACTION` | After a successful import, Remove keeps downloaded files in qBittorrent, Transmission, and Deluge; Remove & Delete Files also deletes them. rTorrent cannot delete download data, so this action leaves its torrent untouched. Blackhole does not support removal. Debrid clients delete temporary local files for either Remove action. | string (choice) | `keep` | | `TORRENT_NO_SEEDERS_WAIT` | Give up on a torrent when its client sees no seed at all for this long, even while it is still downloading, or fewer seeds than the minimum below while nothing is downloading. The torrent is removed and the download marked failed, so another release can be tried. The card shows the seed count and a countdown while it waits. 0 keeps the default behaviour (only the stall timer ends it). Only qBittorrent reports seed counts. | number | `0` | -| `TORRENT_MIN_SEEDERS` | Seeds the client must see for a motionless torrent to keep waiting. 0 also turns the no-seed check off. | number | `1` | +| `TORRENT_MIN_SEEDERS` | Seeds the client must see for a motionless torrent to keep waiting. 0 also turns the no-seed check off. Only qBittorrent reports seed counts. | number | `1` | | `PROWLARR_TORRENT_POST_IMPORT_CATEGORY` | Category or label to assign after a successful import | string | _empty string_ | | `TORRENT_STALL_TIMEOUT_MINUTES` | How long a torrent can go without any progress before Shelfmark cancels it. Applies from when the torrent starts and restarts each time it moves. Raise it for slow swarms or magnets that take a while to find peers, or lower it to give up on dead torrents sooner. | number | `15` | | `PROWLARR_USENET_CLIENT` | Choose which usenet client to use | string (choice) | _empty string_ | @@ -2779,7 +2779,7 @@ Give up on a torrent when its client sees no seed at all for this long, even whi **Minimum Seeders** -Seeds the client must see for a motionless torrent to keep waiting. 0 also turns the no-seed check off. +Seeds the client must see for a motionless torrent to keep waiting. 0 also turns the no-seed check off. Only qBittorrent reports seed counts. - **Type:** number - **Default:** `1` diff --git a/shelfmark/download/clients/settings.py b/shelfmark/download/clients/settings.py index dd79b324..67a62a7a 100644 --- a/shelfmark/download/clients/settings.py +++ b/shelfmark/download/clients/settings.py @@ -1084,16 +1084,19 @@ def prowlarr_clients_settings() -> list[SettingsField]: default=0, min_value=0, max_value=240, - show_when={"field": "PROWLARR_TORRENT_CLIENT", "notEmpty": True}, + show_when={"field": "PROWLARR_TORRENT_CLIENT", "value": "qbittorrent"}, ), NumberField( key="TORRENT_MIN_SEEDERS", label="Minimum Seeders", - description="Seeds the client must see for a motionless torrent to keep waiting. 0 also turns the no-seed check off.", + description=( + "Seeds the client must see for a motionless torrent to keep waiting. 0 also " + "turns the no-seed check off. Only qBittorrent reports seed counts." + ), default=1, min_value=0, max_value=1000, - show_when={"field": "PROWLARR_TORRENT_CLIENT", "notEmpty": True}, + show_when={"field": "PROWLARR_TORRENT_CLIENT", "value": "qbittorrent"}, ), TextField( key="PROWLARR_TORRENT_POST_IMPORT_CATEGORY", diff --git a/tests/prowlarr/test_qbittorrent_settings.py b/tests/prowlarr/test_qbittorrent_settings.py index 436f90a2..8a2ef827 100644 --- a/tests/prowlarr/test_qbittorrent_settings.py +++ b/tests/prowlarr/test_qbittorrent_settings.py @@ -65,6 +65,18 @@ def test_api_key_field_is_registered(): assert field.show_when == {"field": "PROWLARR_TORRENT_CLIENT", "value": "qbittorrent"} +@pytest.mark.parametrize("key", ["TORRENT_NO_SEEDERS_WAIT", "TORRENT_MIN_SEEDERS"]) +def test_seed_settings_are_offered_for_qbittorrent_only(key): + """Only qBittorrent reports seed counts, so the other torrent clients ignore these (U7).""" + from shelfmark.download.clients.settings import prowlarr_clients_settings + + field = _get_field(prowlarr_clients_settings(), key) + + assert field is not None + assert field.show_when == {"field": "PROWLARR_TORRENT_CLIENT", "value": "qbittorrent"} + assert "qBittorrent" in field.description + + @pytest.mark.parametrize( ("api_key", "expected_kwarg", "expected_suffix"), [(API_KEY, API_KEY, " using the API key"), ("", None, "")],