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.
This commit is contained in:
splitsec2 authored and GitHub committed 2026-10-24 09:15:55 -06:00
1 parent 70fe4b8c89
commit 606e94fde2
3 files changed
+20 -5

No files matched your search

+2 -2
View File
@@ -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`
+6 -3
View File
@@ -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",
@@ -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, "")],