libtorrent python api
Project description
LibtorrentX
A python wrapper for libtorrent, makes it easy to manage torrents. Built in support for state management and state recovery after restart.
- Easily pause and resume your torrent streams.
- Optimized settings for faster download speeds.
Install via pip
pip install libtorrentx
Simple demo app
import libtorrentx
import time
magnet = "magnet:?xt=urn:btih:1C0AD4A6A8CF5E26B6E57C3129CFAE9F42807037"
output_dir = "./downloads"
client = libtorrentx.TorrentClient()
torrent = client.add_torrent(magnet, output_dir)
if torrent:
while True:
status, props = torrent.read()
if not status: continue
print(f"{props.name}, {(props.download_speed+1) / 1e+6:.2f} MB/s, {props.progress}%")
if props.is_finished: break
time.sleep(1)
client.close()
or use CLI libtorrentx -m magnet:?xt=urn:btih:1C0AD4A6A8CF5E26B6E57C3129CFAE9F42807037
Output
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 1.20 MB/s, 19%
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 12.00 MB/s, 19%
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 28.11 MB/s, 77%
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 29.00 MB/s, 100%
You can stop the execution and restart again, the download will resume from previous state.
Install via Docker
docker build . -t libtorrentx
docker run --rm -it -v $(pwd)/downloads:/app/downloads libtorrentx -m magnet:?xt=urn:btih:1C0AD4A6A8CF5E26B6E57C3129CFAE9F42807037
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
libtorrentx-0.0.2.tar.gz
(6.6 kB
view details)
Built Distribution
libtorrentx-0.0.2-py3.8.egg
(15.8 kB
view details)
File details
Details for the file libtorrentx-0.0.2.tar.gz
.
File metadata
- Download URL: libtorrentx-0.0.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.11.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82b39b28b8d8dab695b72db7a8156c001b21147e5a69bf148fc8d8614a01e2ed |
|
MD5 | 148ce31c5be4903e5a4254454e3cb2d3 |
|
BLAKE2b-256 | 97eb6348fdbdd99a2816658551e79136328face77e62259799ccbfe3a74672a5 |
File details
Details for the file libtorrentx-0.0.2-py3.8.egg
.
File metadata
- Download URL: libtorrentx-0.0.2-py3.8.egg
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.11.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46ea6c204b65190cf64b142c684a05cc3b66b326ef637400b3aa17d61dfc1004 |
|
MD5 | acb73624f6da556c2c0cdfb7ce9995a1 |
|
BLAKE2b-256 | c0943b8365097076036e4cbcd6b3ab28486a25dba723648a1e5adfbc1cdcc4a4 |