Metadata-Version: 2.5
Name: deluge-utilities
Version: 0.0.6
Summary: A set of utilities to help you work with Deluge and qBittorrent
Project-URL: Homepage, https://github.com/GitBib/deluge-utilities
Project-URL: Repository, https://github.com/GitBib/deluge-utilities
Project-URL: Bug Tracker, https://github.com/GitBib/deluge-utilities/issues
Author-email: GitBib <job@bnff.website>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: deluge,qbittorrent,torrent,utilities
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.10
Requires-Dist: deluge-client<2,>=1.10.2
Requires-Dist: qbittorrent-api>=2025.7.0
Description-Content-Type: text/markdown

# deluge-utilities

A set of utilities to help you work with Deluge and qBittorrent torrent clients.

## Features

- Unified interface for both Deluge and qBittorrent clients
- Automatic detection and removal of duplicate torrents
- Clean up extra files in torrent folders
- Search and remove old torrents while keeping the newest version
- Support for local or remote Deluge daemons and remote qBittorrent Web UI

## Installation

```bash
pip install deluge-utilities
```

For development:

```bash
git clone https://github.com/GitBib/deluge-utilities.git
cd deluge-utilities
uv sync
```

## Usage

### Deluge Client

```python
from deluge_utilities import Deluge

# Initialize Deluge client (connects to local daemon)
client = Deluge(
    username="your_deluge_username",
    password="your_deluge_password"
)

# Or connect to a remote daemon (defaults: host="127.0.0.1", port=58846)
remote = Deluge(
    username="your_deluge_username",
    password="your_deluge_password",
    host="192.0.2.10",
    port=58846,
)

# Get list of all torrents grouped by name
torrents = client.torrent_dict()

# Search and remove old duplicate torrents, keeping only the newest
client.old_torrent_search(dry_run=False)

# Check all torrents for extra files and remove them
client.torrent_check(dry_run=False)

# Get information about a specific torrent
torrent_info = client.get_torrent_info("torrent_id")

# Remove a specific torrent
client.remove_torrent("torrent_id")
```

### qBittorrent Client

```python
from deluge_utilities import QBittorrent

# Initialize qBittorrent client (connects to Web UI)
client = QBittorrent(
    host="localhost",
    port=8080,
    username="your_qbittorrent_username",
    password="your_qbittorrent_password"
)

# Get list of all torrents grouped by name
torrents = client.torrent_dict()

# Search and remove old duplicate torrents, keeping only the newest
client.old_torrent_search(dry_run=False)

# Check all torrents for extra files and remove them
client.torrent_check(dry_run=False)

# Get information about a specific torrent
torrent_info = client.get_torrent_info("torrent_hash")

# Remove a specific torrent
client.remove_torrent("torrent_hash")
```

### Polymorphic Usage

Both clients implement the same interface, allowing you to switch between them easily:

```python
from deluge_utilities import Deluge, QBittorrent

# Choose client based on configuration
client_type = "qbittorrent"  # or "deluge"

if client_type == "deluge":
    client = Deluge(username="admin", password="password")
else:
    client = QBittorrent(
        host="localhost",
        port=8080,
        username="admin",
        password="password"
    )

# Use the same methods regardless of client type
torrents = client.torrent_dict()
client.old_torrent_search(dry_run=False)
client.torrent_check(dry_run=False)
```
