# qBittorrent AI Agent An AI-powered assistant for qBittorrent that allows natural language interaction with your torrent client. ## Features - **Natural Language Interface**: Interact with qBittorrent using natural language commands - **Search Torrents**: Search for torrents directly through the AI interface - **Download Management**: View active downloads and add new torrents - **Media Information**: Get detailed information about movies and TV shows - **Movie Recommendations**: Find movie suggestions based on your preferences - **Web Interface**: Built with Gradio for easy access through your browser - **Command Line Interface**: Optional CLI mode for terminal-based interactions ## Requirements - Python 3.8+ - qBittorrent with WebUI enabled - OpenAI API key or Ollama with qwen2.5-coder model ## Installation 1. Clone this repository 2. Install dependencies: ``` pip install -r requirements.txt ``` 3. Create a `.env` file with your configuration: ``` # qBittorrent API Configuration QBIT_HOST=http://localhost:8080 QBIT_USERNAME=admin QBIT_PASSWORD=password # OpenAI API Key OPENAI_API_KEY=your_openai_api_key # DuckDuckGo Search Configuration DUCKDUCKGO_ENABLED=true DUCKDUCKGO_MAX_RESULTS=5 # Optional: OMDB API key for movie information OMDB_API_KEY=your_omdb_api_key ``` ## Usage Run the web interface: ``` python main.py ``` Or use the CLI interface by uncommenting the `cli_main()` line in `main.py`. ### Example Commands - "Find me sci-fi movies from 2023" - "Show my current downloads" - "Search for Game of Thrones season 1" - "Tell me about the movie Interstellar" - "What are some movies similar to The Matrix?" - "Download the latest Ubuntu ISO" ## Tools The agent uses specialized tools organized into separate files for better modularity: ### qBittorrent Tools (`tools/qbit.py`) - `get_downloads_list`: Get information about current downloads - `qbittorrent_search`: Search for torrents using qBittorrent's search functionality - `download_torrent`: Add a torrent to the download queue ### Search Tools (`tools/search.py`) - `duckduckgo_search`: Search the web using DuckDuckGo for movie and TV show information - `movies_advice_search`: Get recommendations and movie suggestions from multiple trusted sources ## How It Works The agent uses LangChain to connect to either OpenAI or Ollama models. It maintains conversation memory to provide context-aware responses. The agent intelligently decides which tool to use based on user queries and formats the responses in a user-friendly way. ## License MIT