diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7275bb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv/ diff --git a/deps/__init__.py b/deps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/deps/__pycache__/__init__.cpython-312.pyc b/deps/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..f7e1d92 Binary files /dev/null and b/deps/__pycache__/__init__.cpython-312.pyc differ diff --git a/deps/libtorrent-2.0.11.dist-info/INSTALLER b/deps/libtorrent-2.0.11.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/deps/libtorrent-2.0.11.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/deps/libtorrent-2.0.11.dist-info/METADATA b/deps/libtorrent-2.0.11.dist-info/METADATA new file mode 100644 index 0000000..ffb8f44 --- /dev/null +++ b/deps/libtorrent-2.0.11.dist-info/METADATA @@ -0,0 +1,16 @@ +Metadata-Version: 2.2 +Name: libtorrent +Version: 2.0.11 +Summary: Python bindings for libtorrent-rasterbar +Home-page: http://libtorrent.org +Author: Arvid Norberg +Author-email: arvid@libtorrent.org +License: BSD +Dynamic: author +Dynamic: author-email +Dynamic: description +Dynamic: home-page +Dynamic: license +Dynamic: summary + +Python bindings for libtorrent-rasterbar diff --git a/deps/libtorrent-2.0.11.dist-info/RECORD b/deps/libtorrent-2.0.11.dist-info/RECORD new file mode 100644 index 0000000..a9e9e34 --- /dev/null +++ b/deps/libtorrent-2.0.11.dist-info/RECORD @@ -0,0 +1,7 @@ +libtorrent-2.0.11.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +libtorrent-2.0.11.dist-info/METADATA,sha256=sPtq23Wl5bUYxfIuAo34PrNgCXVR7j5icBJXapZiVX4,362 +libtorrent-2.0.11.dist-info/RECORD,, +libtorrent-2.0.11.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +libtorrent-2.0.11.dist-info/WHEEL,sha256=siqMuoWpRueIZ87ijidBxnOwHeSOOcxNwYCs-pC4Yv0,151 +libtorrent-2.0.11.dist-info/top_level.txt,sha256=Va3S8jfMOK-hJMDdMSrC7MrqlelkXSU30H5E4QppA3c,11 +libtorrent/__init__.cpython-312-x86_64-linux-gnu.so,sha256=A37ASE55Ar1brGnb2Ptb85-TcV7E-vK3T3cE3zsDJxU,26320472 diff --git a/deps/libtorrent-2.0.11.dist-info/REQUESTED b/deps/libtorrent-2.0.11.dist-info/REQUESTED new file mode 100644 index 0000000..e69de29 diff --git a/deps/libtorrent-2.0.11.dist-info/WHEEL b/deps/libtorrent-2.0.11.dist-info/WHEEL new file mode 100644 index 0000000..074b7f8 --- /dev/null +++ b/deps/libtorrent-2.0.11.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (75.8.0) +Root-Is-Purelib: false +Tag: cp312-cp312-manylinux_2_17_x86_64 +Tag: cp312-cp312-manylinux2014_x86_64 + diff --git a/deps/libtorrent-2.0.11.dist-info/top_level.txt b/deps/libtorrent-2.0.11.dist-info/top_level.txt new file mode 100644 index 0000000..5923a7f --- /dev/null +++ b/deps/libtorrent-2.0.11.dist-info/top_level.txt @@ -0,0 +1 @@ +libtorrent diff --git a/deps/libtorrent/__init__.cpython-312-x86_64-linux-gnu.so b/deps/libtorrent/__init__.cpython-312-x86_64-linux-gnu.so new file mode 100755 index 0000000..ca1e484 Binary files /dev/null and b/deps/libtorrent/__init__.cpython-312-x86_64-linux-gnu.so differ diff --git a/deps/requirements.txt b/deps/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/mvm.py b/mvm.py new file mode 100644 index 0000000..ff63f48 --- /dev/null +++ b/mvm.py @@ -0,0 +1,42 @@ + +import libtorrent as lt +import time +import os + +ses = lt.session() +ses.listen_on(6881, 6891) + +magnet_uri = "magnet:?xt=urn:btih:19223321411e27f51213a2407842d773f0f8ac4e" +params = {'save_path': './downloads/'} + +handle = lt.add_magnet_uri(ses, magnet_uri, params) + +print("Fetching metadata (torrent info)...") +while not handle.has_metadata(): + time.sleep(1) + print(".", end="", flush=True) + +print("\nMetadata received!") + +torrent_info = handle.get_torrent_info() + +print("\nFiles in torrent:") +for idx, f in enumerate(torrent_info.files()): + print(f"[{idx}] {f.path} ({f.size / 1_000_000:.2f} MB)") + +selected_indexes = [0, 2] + +file_priorities = [0] * torrent_info.num_files() +for i in selected_indexes: + file_priorities[i] = 1 + +handle.prioritize_files(file_priorities) + +print("\nDownloading selected files only...") +while handle.status().state != lt.torrent_status.seeding: + s = handle.status() + print(f"\rProgress: {s.progress * 100:.2f}% | Down: {s.download_rate / 1000:.1f} kB/s | Peers: {s.num_peers}", end=" ") + time.sleep(1) + +print("\nDownload complete!") +