diff --git a/Writerside/topics/Indexer-Settings.md b/Writerside/topics/Indexer-Settings.md index 47712e0..61ecba9 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_seconds = 60 [indexers.jackett] enabled = false url = "http://jackett:9117" api_key = "your_jackett_api_key" indexers = ["1337x", "rarbg"] +timeout_seconds = 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 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]] 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..007829f 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_seconds = config.timeout_seconds 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_seconds) 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( 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()