Documentation Index
Fetch the complete documentation index at: https://mintlify.com/avikekk/JackettSearchBot/llms.txt
Use this file to discover all available pages before exploring further.
Overview
JackettSearchBot’s service layer provides clean abstractions for core functionality. All services are initialized inJackettSearchBot.__init__() and injected into command handlers.
JackettService
Handles all interactions with the Jackett API, including search queries, XML parsing, and result formatting. Location:jackett_bot/services/jackett.py:29
Initialization
The service automatically manages its HTTP client lifecycle. If you don’t provide a client, it creates one and closes it during cleanup.
Methods
build_search_url(query: str) → str
build_search_url(query: str) → str
Constructs the Jackett API URL for a given query.Parameters:Source:
query(str): Search query or IMDB ID
- Detects IMDB IDs (format:
ttfollowed by digits) - Uses
imdbidparameter for IMDB searches - Uses
qparameter with URL encoding for text searches - Searches across all configured indexers (
/indexers/all/)
jackett_bot/services/jackett.py:41search(query: str, golden_popcorn: bool, timeout: int) → list[SearchResult]
search(query: str, golden_popcorn: bool, timeout: int) → list[SearchResult]
Performs an async search against Jackett and returns parsed results.Parameters:Source:
query(str): Search query or IMDB IDgolden_popcorn(bool): Filter for Golden Popcorn releases only (default: False)timeout(int): Request timeout in seconds (default: 15)
SearchResult objectsExample:jackett_bot/services/jackett.py:54close() → None
close() → None
Closes the HTTP client if owned by the service.Usage:Source:
jackett_bot/services/jackett.py:63SearchResult DataClass
Location:jackett_bot/services/jackett.py:12
Helper Functions
AuthorizationService
Thread-safe service for managing bot access control with both permanent (configured) and temporary (runtime) authorization lists. Location:jackett_bot/services/auth.py:5
Initialization
Authorization Model
The service maintains two separate authorization lists:-
Configured IDs (
_configured_ids)- Loaded from
AUTHORIZED_CHAT_IDSenvironment variable - Permanent for the bot’s lifetime
- Cannot be removed via
/unauth - Persisted across restarts (via config file)
- Loaded from
-
Temporary IDs (
_temporary_ids)- Added via
/authcommand at runtime - Stored in-memory only
- Can be removed via
/unauthor/unauthall - Cleared when bot restarts
- Added via
Methods
add_authorized(entity_id: int) → bool
add_authorized(entity_id: int) → bool
remove_authorized(entity_id: int) → bool
remove_authorized(entity_id: int) → bool
clear_authorized() → int
clear_authorized() → int
is_configured_id_authorized(entity_id: int) → bool
is_configured_id_authorized(entity_id: int) → bool
is_temporary_id_authorized(entity_id: int) → bool
is_temporary_id_authorized(entity_id: int) → bool
list_configured_ids() → list[int]
list_configured_ids() → list[int]
Returns sorted list of all configured IDs.Source:
jackett_bot/services/auth.py:39list_temporary_ids() → list[int]
list_temporary_ids() → list[int]
Returns sorted list of all temporary IDs.Source:
jackett_bot/services/auth.py:43Thread Safety
All methods usethreading.RLock() for thread-safe access:
PTPService
Simple service for checking PassThePopcorn availability. Location:jackett_bot/services/ptp.py:4
Initialization
Methods
is_available(timeout: int) → bool
is_available(timeout: int) → bool
Checks if PTP is reachable and responding.Parameters:Implementation:Source:
timeout(int): Request timeout in seconds (default: 5)
True if PTP responds with successful status, False on any HTTP errorExample:jackett_bot/services/ptp.py:10close() → None
close() → None
Closes the HTTP client if owned by the service.Source:
jackett_bot/services/ptp.py:18Service Integration
Services are wired together in theJackettSearchBot class:
This dependency injection pattern makes services easy to test and swap out if needed.