add config option to accept/reject torrents from prowlarr with a possibly broken url

This commit is contained in:
maxDorninger
2025-10-30 18:20:57 +01:00
parent 571dcd1cf8
commit 8346ed9fa5
5 changed files with 25 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
# Indexers
Indexer settings are configured in the `[indexers]` section of your `config.toml` file. MediaManager supports both Prowlarr and Jackett as indexer providers.
Indexer settings are configured in the `[indexers]` section of your `config.toml` file. MediaManager supports both
Prowlarr and Jackett as indexer providers.
## Prowlarr (`[indexers.prowlarr]`)
@@ -16,6 +17,12 @@ Base URL of your Prowlarr instance.
API key for Prowlarr. You can find this in Prowlarr's settings under General.
- `reject_torrents_on_url_error`
Set to `true` to reject torrents if there is a URL error when fetching from Prowlarr. Until MediaManager v1.9.0 the
default behavior was `false`, but from v1.9.0 onwards the default is `true`. It's recommended to set this to `true` to
avoid adding possibly invalid torrents.
## Jackett (`[indexers.jackett]`)
- `enabled`
@@ -40,14 +47,14 @@ Here's a complete example of the indexers section in your `config.toml`:
```toml
[indexers]
[indexers.prowlarr]
enabled = true
url = "http://prowlarr:9696"
api_key = "your_prowlarr_api_key"
[indexers.prowlarr]
enabled = true
url = "http://prowlarr:9696"
api_key = "your_prowlarr_api_key"
[indexers.jackett]
enabled = false
url = "http://jackett:9117"
api_key = "your_jackett_api_key"
indexers = ["1337x", "rarbg"]
[indexers.jackett]
enabled = false
url = "http://jackett:9117"
api_key = "your_jackett_api_key"
indexers = ["1337x", "rarbg"]
```

View File

@@ -119,6 +119,7 @@ base_path = "/api"
enabled = false
url = "http://localhost:9696"
api_key = ""
reject_torrents_on_url_error = true
# Jackett settings
[indexers.jackett]

View File

@@ -119,6 +119,7 @@ base_path = "/api"
enabled = false
url = "http://localhost:9696"
api_key = ""
reject_torrents_on_url_error = true
# Jackett settings
[indexers.jackett]

View File

@@ -5,6 +5,7 @@ class ProwlarrConfig(BaseSettings):
enabled: bool = False
api_key: str = ""
url: str = "http://localhost:9696"
reject_torrents_on_url_error: bool = True
class JackettConfig(BaseSettings):

View File

@@ -25,6 +25,7 @@ class Prowlarr(GenericIndexer):
config = AllEncompassingConfig().indexers.prowlarr
self.api_key = config.api_key
self.url = config.url
self.reject_torrents_on_url_error = config.reject_torrents_on_url_error
log.debug("Registering Prowlarr as Indexer")
def search(self, query: str, is_tv: bool) -> list[IndexerQueryResult]:
@@ -96,7 +97,10 @@ class Prowlarr(GenericIndexer):
log.debug(
f"Failed to follow redirects for {initial_url}, falling back to the initial url as download url, error: {e}"
)
final_download_url = initial_url
if self.reject_torrents_on_url_error:
return None
else:
final_download_url = initial_url
else:
final_download_url = initial_url
return IndexerQueryResult(