Files
Jarvis/api/test.py
MrZaiko ee32057c0b
All checks were successful
Build and Deploy / build (push) Successful in 3m41s
Fix torrent api bug
2025-04-19 22:16:25 +02:00

21 lines
700 B
Python

#!/usr/bin/env python3
from qbittorrent import Client
from torrent import TorrentApi
# Replace with your qBittorrent Web UI credentials
torrent = TorrentApi("http://192.168.1.17:8112", "tMHNjrJr7nhjyhJrYsahi4anq2h6LJ")
# Retrieve all active torrents
torrents = torrent.get_torrents()
# Print details of each active torrent
for torrent in torrents:
print(f"Name: {torrent['name']}")
print(f"State: {torrent['state']}")
print(f"Progress: {torrent['progress'] * 100:.2f}%")
print(f"Download Speed: {torrent['dlspeed'] / 1024:.2f} KB/s")
print(f"Upload Speed: {torrent['upspeed'] / 1024:.2f} KB/s")
print(f"Size: {torrent['size'] / (1024 * 1024):.2f} MB")
print("-" * 40)