From fe3b77a889045fd99b46c15f43f470caf7bbd72b Mon Sep 17 00:00:00 2001 From: maxid Date: Wed, 10 Dec 2025 17:13:24 +0100 Subject: [PATCH 1/5] add a config variable for jackett and prowlarr to change timeout time --- media_manager/indexer/config.py | 2 ++ media_manager/indexer/indexers/jackett.py | 3 ++- media_manager/indexer/indexers/prowlarr.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/media_manager/indexer/config.py b/media_manager/indexer/config.py index 04e8063..dafa971 100644 --- a/media_manager/indexer/config.py +++ b/media_manager/indexer/config.py @@ -6,6 +6,7 @@ class ProwlarrConfig(BaseSettings): api_key: str = "" url: str = "http://localhost:9696" reject_torrents_on_url_error: bool = True + timeout_seconds: int = 60 class JackettConfig(BaseSettings): @@ -13,6 +14,7 @@ class JackettConfig(BaseSettings): api_key: str = "" url: str = "http://localhost:9696" indexers: list[str] = ["all"] + timeout_seconds: int = 60 class ScoringRule(BaseSettings): diff --git a/media_manager/indexer/indexers/jackett.py b/media_manager/indexer/indexers/jackett.py index d92ba90..561b337 100644 --- a/media_manager/indexer/indexers/jackett.py +++ b/media_manager/indexer/indexers/jackett.py @@ -24,6 +24,7 @@ class Jackett(GenericIndexer): self.api_key = config.api_key self.url = config.url self.indexers = config.indexers + self.timeout = config.timeout def search(self, query: str, is_tv: bool) -> list[IndexerQueryResult]: log.debug("Searching for " + query) @@ -59,7 +60,7 @@ class Jackett(GenericIndexer): self.url + f"/api/v2.0/indexers/{indexer}/results/torznab/api?apikey={self.api_key}&t={'tvsearch' if is_tv else 'movie'}&q={query}" ) - response = session.get(url) + response = session.get(url, timeout=self.timeout) if response.status_code != 200: log.error( diff --git a/media_manager/indexer/indexers/prowlarr.py b/media_manager/indexer/indexers/prowlarr.py index e0dda43..66d90f4 100644 --- a/media_manager/indexer/indexers/prowlarr.py +++ b/media_manager/indexer/indexers/prowlarr.py @@ -26,6 +26,7 @@ class Prowlarr(GenericIndexer): self.api_key = config.api_key self.url = config.url self.reject_torrents_on_url_error = config.reject_torrents_on_url_error + self.timeout_seconds = config.timeout_seconds def search(self, query: str, is_tv: bool) -> list[IndexerQueryResult]: log.debug("Searching for " + query) @@ -98,6 +99,7 @@ class Prowlarr(GenericIndexer): final_download_url = follow_redirects_to_final_torrent_url( initial_url=initial_url, session=session, + timeout=self.timeout_seconds, ) except RuntimeError as e: log.warning( From 1ddcef0676ededb140b9d184494a6b0edd28fd91 Mon Sep 17 00:00:00 2001 From: maxid Date: Wed, 10 Dec 2025 17:15:43 +0100 Subject: [PATCH 2/5] add timeout config value to example configs --- config.dev.toml | 2 ++ config.example.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/config.dev.toml b/config.dev.toml index 9a5f85c..3ae7e43 100644 --- a/config.dev.toml +++ b/config.dev.toml @@ -120,6 +120,7 @@ enabled = false url = "http://localhost:9696" api_key = "" reject_torrents_on_url_error = true +timeout_seconds = 60 # Jackett settings [indexers.jackett] @@ -127,6 +128,7 @@ enabled = false url = "http://localhost:9117" api_key = "" indexers = ["1337x", "torrentleech"] # List of indexer names to use +timeout_seconds = 60 # Title-based scoring rules [[indexers.title_scoring_rules]] diff --git a/config.example.toml b/config.example.toml index 8dacbb4..ed5f1b6 100644 --- a/config.example.toml +++ b/config.example.toml @@ -120,6 +120,7 @@ enabled = false url = "http://localhost:9696" api_key = "" reject_torrents_on_url_error = true +timeout_seconds = 60 # Jackett settings [indexers.jackett] @@ -127,6 +128,7 @@ enabled = false url = "http://localhost:9117" api_key = "" indexers = ["1337x", "torrentleech"] # List of indexer names to use +timeout_seconds = 60 # Title-based scoring rules [[indexers.title_scoring_rules]] From 8f2f016b61e281b944492d627f0f2f72ed18d1a9 Mon Sep 17 00:00:00 2001 From: maxid Date: Wed, 10 Dec 2025 17:50:04 +0100 Subject: [PATCH 3/5] add timeout to docs --- Writerside/topics/Indexer-Settings.md | 23 ++++++++++++++++++++++- Writerside/topics/troubleshooting.md | 10 ++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Writerside/topics/Indexer-Settings.md b/Writerside/topics/Indexer-Settings.md index 47712e0..e8231c0 100644 --- a/Writerside/topics/Indexer-Settings.md +++ b/Writerside/topics/Indexer-Settings.md @@ -21,7 +21,20 @@ API key for Prowlarr. You can find this in Prowlarr's settings under General. 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. +avoid adding possibly invalid torrents. + +- `timeout_seconds` + +Timeout in seconds for requests to Prowlarr. Default is `60` seconds. +Symptoms of timeouts are typically no search results (*"No torrents found!"*) in conjunction with logs like these: + +``` +DEBUG - media_manager.indexer.utils - + follow_redirects_to_final_torrent_url(): + An error occurred during the request for : + HTTPConnectionPool(host='', port=): + Read timed out. (read timeout=10) +``` ## Jackett (`[indexers.jackett]`) @@ -41,6 +54,10 @@ API key for Jackett. You can find this in Jackett's dashboard. List of indexer names to use with Jackett. You can specify which indexers Jackett should search through. +- `timeout_seconds` + +Refer to the Prowlarr section for details. + ## Example Configuration Here's a complete example of the indexers section in your `config.toml`: @@ -51,10 +68,14 @@ Here's a complete example of the indexers section in your `config.toml`: enabled = true url = "http://prowlarr:9696" api_key = "your_prowlarr_api_key" +reject_torrents_on_url_error = true +timeout_secnds = 60 [indexers.jackett] enabled = false url = "http://jackett:9117" api_key = "your_jackett_api_key" indexers = ["1337x", "rarbg"] +timeout_secnds = 60 + ``` diff --git a/Writerside/topics/troubleshooting.md b/Writerside/topics/troubleshooting.md index 4ea0427..55090bb 100644 --- a/Writerside/topics/troubleshooting.md +++ b/Writerside/topics/troubleshooting.md @@ -1,9 +1,5 @@ # Troubleshooting - - Note the lack of a trailing slash in some env vars like FRONTEND_URL. This is important. - - Always check the container and browser logs for more specific error messages @@ -28,4 +24,10 @@ Make sure you are using only one volumes for TV, Movies and Downloads. See the configuration in the example docker-compose.yaml file. + + Try switching to the advanced tab when searching for torrents. + If you use "slow" indexers, try increasing the timeout threshold. + If you still don't get any search results, check the logs, they will provide more information on what is going wrong. + + If it still doesn't work, please open an Issue. It is possible that a bug is causing the issue. \ No newline at end of file From c984d40fd3ce60fc112f815a4675561258803b97 Mon Sep 17 00:00:00 2001 From: maxid Date: Wed, 10 Dec 2025 17:50:11 +0100 Subject: [PATCH 4/5] format code --- media_manager/movies/repository.py | 4 +++- media_manager/tv/repository.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/media_manager/movies/repository.py b/media_manager/movies/repository.py index aa8f405..d190673 100644 --- a/media_manager/movies/repository.py +++ b/media_manager/movies/repository.py @@ -231,7 +231,9 @@ class MovieRepository: result = self.db.execute(stmt) if result.rowcount == 0: self.db.rollback() - raise NotFoundError(f"movie request with id {movie_request_id} not found.") + raise NotFoundError( + f"movie request with id {movie_request_id} not found." + ) self.db.commit() # Successfully deleted movie request with id: {movie_request_id} except SQLAlchemyError as e: diff --git a/media_manager/tv/repository.py b/media_manager/tv/repository.py index a374004..37b39f6 100644 --- a/media_manager/tv/repository.py +++ b/media_manager/tv/repository.py @@ -270,7 +270,9 @@ class TvRepository: result = self.db.execute(stmt) if result.rowcount == 0: self.db.rollback() - raise NotFoundError(f"SeasonRequest with id {season_request_id} not found.") + raise NotFoundError( + f"SeasonRequest with id {season_request_id} not found." + ) self.db.commit() except SQLAlchemyError as e: self.db.rollback() From dda9be13bbce5e2edb4ce4e6a50eec341729eca1 Mon Sep 17 00:00:00 2001 From: maxid Date: Wed, 10 Dec 2025 18:12:05 +0100 Subject: [PATCH 5/5] fix typos --- Writerside/topics/Indexer-Settings.md | 4 ++-- media_manager/indexer/indexers/jackett.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Writerside/topics/Indexer-Settings.md b/Writerside/topics/Indexer-Settings.md index e8231c0..61ecba9 100644 --- a/Writerside/topics/Indexer-Settings.md +++ b/Writerside/topics/Indexer-Settings.md @@ -69,13 +69,13 @@ enabled = true url = "http://prowlarr:9696" api_key = "your_prowlarr_api_key" reject_torrents_on_url_error = true -timeout_secnds = 60 +timeout_seconds = 60 [indexers.jackett] enabled = false url = "http://jackett:9117" api_key = "your_jackett_api_key" indexers = ["1337x", "rarbg"] -timeout_secnds = 60 +timeout_seconds = 60 ``` diff --git a/media_manager/indexer/indexers/jackett.py b/media_manager/indexer/indexers/jackett.py index 561b337..007829f 100644 --- a/media_manager/indexer/indexers/jackett.py +++ b/media_manager/indexer/indexers/jackett.py @@ -24,7 +24,7 @@ class Jackett(GenericIndexer): self.api_key = config.api_key self.url = config.url self.indexers = config.indexers - self.timeout = config.timeout + self.timeout_seconds = config.timeout_seconds def search(self, query: str, is_tv: bool) -> list[IndexerQueryResult]: log.debug("Searching for " + query) @@ -60,7 +60,7 @@ class Jackett(GenericIndexer): self.url + f"/api/v2.0/indexers/{indexer}/results/torznab/api?apikey={self.api_key}&t={'tvsearch' if is_tv else 'movie'}&q={query}" ) - response = session.get(url, timeout=self.timeout) + response = session.get(url, timeout=self.timeout_seconds) if response.status_code != 200: log.error(