From 530c730ab9ae4960f46f13bf3d2d55abc53f6e86 Mon Sep 17 00:00:00 2001 From: hidden service Date: Sun, 9 Apr 2023 21:16:53 -0700 Subject: [PATCH] Initial commit Signed-off-by: hidden service --- .gitignore | 175 ++++++++++++++++++++++++++++++++++ README.md | 14 +++ m2t/__init__.py | 50 ++++++++++ m2t/__main__.py | 30 ++++++ mypy.ini | 2 + poetry.lock | 243 +++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 18 ++++ requirements.txt | 10 ++ 8 files changed, 542 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 m2t/__init__.py create mode 100644 m2t/__main__.py create mode 100644 mypy.ini create mode 100644 poetry.lock create mode 100644 pyproject.toml create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71f70a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,175 @@ +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +# End of https://www.toptal.com/developers/gitignore/api/python + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..43e7754 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# magnet2torrent + +Install dependencies with `poetry install` or `pip install -r requirements.txt` + +Requires Python 3.8 or higher and libtorrent. + +# Usage + +This doesn't have a setup.py so you just have to run it in the project directory. You can do this +with: + +`poetry run python3 -m m2t [-o outfile] MAGNET_LINK` + + diff --git a/m2t/__init__.py b/m2t/__init__.py new file mode 100644 index 0000000..8ce4792 --- /dev/null +++ b/m2t/__init__.py @@ -0,0 +1,50 @@ +import logging +from pathlib import Path +import time +import tempfile +from typing import Optional + +import libtorrent + + +def magnet2torrent(magnet: str, output: Path): + log = logging.getLogger() + + if not output.parent.is_dir(): + raise Exception("Invalid output file: directory does not exist") + + with tempfile.TemporaryDirectory() as tmp_dir: + session = libtorrent.session() + #params = { + # "save_path": tmp_dir, + # "storage_mode": libtorrent.storage_mode_t(2), + # "paused": False, + # "auto_managed": True, + # "duplicate_is_error": True, + #} + #handle = libtorrent.add_magnet_uri(session, magnet, params) + + params = libtorrent.parse_magnet_uri(magnet) + handle = session.add_torrent(params) + log.info("Downloading metadata") + while not handle.has_metadata(): + try: + time.sleep(1) + except KeyboardInterrupt: + log.info("Cleaning up") + session.pause() + raise + session.pause() + log.info("Done") + + info = handle.get_torrent_info() + torrent_file = libtorrent.create_torrent(info) + torrent_path = Path(info.name() + ".torrent").absolute() + + if output.is_dir(): + output = output / torrent_path.name + + log.info("Writing to %s", output) + content = libtorrent.bencode(torrent_file.generate()) + output.write_bytes(content) + session.remove_torrent(handle) diff --git a/m2t/__main__.py b/m2t/__main__.py new file mode 100644 index 0000000..ee57345 --- /dev/null +++ b/m2t/__main__.py @@ -0,0 +1,30 @@ +from argparse import ArgumentParser +import logging +from pathlib import Path + +from . import magnet2torrent + + +logging.basicConfig( + format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", + level=logging.INFO, +) + + +parser = ArgumentParser(description="Create a torrent file from a magnet link.") +parser.add_argument( + "MAGNET", + help="The magnet link itself.", +) +parser.add_argument( + "-o", + "--out", + help="The path to write the file to. May be a directory.", + default=".", + type=Path, + required=False, +) + +args = parser.parse_args() + +magnet2torrent(args.MAGNET, args.out) diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..c79cd82 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,2 @@ +[mypy-libtorrent.*] +ignore_missing_imports = True diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..730ed0c --- /dev/null +++ b/poetry.lock @@ -0,0 +1,243 @@ +[[package]] +name = "black" +version = "23.3.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" + +[[package]] +name = "libtorrent" +version = "2.0.7" +description = "Python bindings for libtorrent-rasterbar" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "mypy" +version = "1.2.0" +description = "Optional static typing for Python" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=3.10" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +category = "dev" +optional = false +python-versions = ">=3.5" + +[[package]] +name = "packaging" +version = "23.0" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "pathspec" +version = "0.11.1" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "platformdirs" +version = "3.2.0" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "typing-extensions" +version = "4.5.0" +description = "Backported and Experimental Type Hints for Python 3.7+" +category = "dev" +optional = false +python-versions = ">=3.7" + +[metadata] +lock-version = "1.1" +python-versions = "^3.10" +content-hash = "b8e53192e5ac8f571ed846ca708bc1a007ccf888443df56822f5ce742ef29e78" + +[metadata.files] +black = [ + {file = "black-23.3.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:0945e13506be58bf7db93ee5853243eb368ace1c08a24c65ce108986eac65915"}, + {file = "black-23.3.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:67de8d0c209eb5b330cce2469503de11bca4085880d62f1628bd9972cc3366b9"}, + {file = "black-23.3.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:7c3eb7cea23904399866c55826b31c1f55bbcd3890ce22ff70466b907b6775c2"}, + {file = "black-23.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:32daa9783106c28815d05b724238e30718f34155653d4d6e125dc7daec8e260c"}, + {file = "black-23.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:35d1381d7a22cc5b2be2f72c7dfdae4072a3336060635718cc7e1ede24221d6c"}, + {file = "black-23.3.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:a8a968125d0a6a404842fa1bf0b349a568634f856aa08ffaff40ae0dfa52e7c6"}, + {file = "black-23.3.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c7ab5790333c448903c4b721b59c0d80b11fe5e9803d8703e84dcb8da56fec1b"}, + {file = "black-23.3.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:a6f6886c9869d4daae2d1715ce34a19bbc4b95006d20ed785ca00fa03cba312d"}, + {file = "black-23.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f3c333ea1dd6771b2d3777482429864f8e258899f6ff05826c3a4fcc5ce3f70"}, + {file = "black-23.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:11c410f71b876f961d1de77b9699ad19f939094c3a677323f43d7a29855fe326"}, + {file = "black-23.3.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:1d06691f1eb8de91cd1b322f21e3bfc9efe0c7ca1f0e1eb1db44ea367dff656b"}, + {file = "black-23.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:50cb33cac881766a5cd9913e10ff75b1e8eb71babf4c7104f2e9c52da1fb7de2"}, + {file = "black-23.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:e114420bf26b90d4b9daa597351337762b63039752bdf72bf361364c1aa05925"}, + {file = "black-23.3.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:48f9d345675bb7fbc3dd85821b12487e1b9a75242028adad0333ce36ed2a6d27"}, + {file = "black-23.3.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:714290490c18fb0126baa0fca0a54ee795f7502b44177e1ce7624ba1c00f2331"}, + {file = "black-23.3.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:064101748afa12ad2291c2b91c960be28b817c0c7eaa35bec09cc63aa56493c5"}, + {file = "black-23.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:562bd3a70495facf56814293149e51aa1be9931567474993c7942ff7d3533961"}, + {file = "black-23.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:e198cf27888ad6f4ff331ca1c48ffc038848ea9f031a3b40ba36aced7e22f2c8"}, + {file = "black-23.3.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:3238f2aacf827d18d26db07524e44741233ae09a584273aa059066d644ca7b30"}, + {file = "black-23.3.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:f0bd2f4a58d6666500542b26354978218a9babcdc972722f4bf90779524515f3"}, + {file = "black-23.3.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:92c543f6854c28a3c7f39f4d9b7694f9a6eb9d3c5e2ece488c327b6e7ea9b266"}, + {file = "black-23.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a150542a204124ed00683f0db1f5cf1c2aaaa9cc3495b7a3b5976fb136090ab"}, + {file = "black-23.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:6b39abdfb402002b8a7d030ccc85cf5afff64ee90fa4c5aebc531e3ad0175ddb"}, + {file = "black-23.3.0-py3-none-any.whl", hash = "sha256:ec751418022185b0c1bb7d7736e6933d40bbb14c14a0abcf9123d1b159f98dd4"}, + {file = "black-23.3.0.tar.gz", hash = "sha256:1c7b8d606e728a41ea1ccbd7264677e494e87cf630e399262ced92d4a8dac940"}, +] +click = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] +colorama = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] +libtorrent = [ + {file = "libtorrent-2.0.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7ac05ec01dd89642327c2e03444ad9aca87a7ab8c9e795a2da93a9c930d3c61f"}, + {file = "libtorrent-2.0.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c7513a1b2478507db46fbacd4d3d54e6666c158b71f989408e0c5e62b5ce1aa6"}, + {file = "libtorrent-2.0.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ee696a35d85ae0423a74c66ea018ad540b762d6edfd221d4cb49928e87979d8"}, + {file = "libtorrent-2.0.7-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:a67be057b3bac921fb3158db25d1e3ab14c07b6f21a97fff18143f18b5061e6e"}, + {file = "libtorrent-2.0.7-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:9fd1644fbda3d45d5d9a3d1f9e9ed179d911f92d5b908a80fd34fef689cfe0f5"}, + {file = "libtorrent-2.0.7-cp310-cp310-win32.whl", hash = "sha256:4291680c3e759c8022dbde24a0d1375b5d08d9f56d2a714abd29248f8ba2966c"}, + {file = "libtorrent-2.0.7-cp310-cp310-win_amd64.whl", hash = "sha256:604eec9d3296007048a3e7426b5ba1961dace3a69a589351492a8de9dfc5cd60"}, + {file = "libtorrent-2.0.7-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5d066257cc5e1841ae9d66df621d66a129b15a2094038f127e5075b0fbd6923b"}, + {file = "libtorrent-2.0.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c9b7fd5d975434b32ee207588bfb43bac191bf77720a81c8920a3d36aee4fde8"}, + {file = "libtorrent-2.0.7-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d387ebd4cebdca089f3be26223d7a8deebdfab64f5fd4ff7f2d2c7e03a30a0af"}, + {file = "libtorrent-2.0.7-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:5ff2391f33c1dd1847dd7abf1c96cf076bd9c19e24ddb9313ae6f848bfd87b7d"}, + {file = "libtorrent-2.0.7-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:20c82f8332aa44c34cbe5daf24a664c515a98902ba8dc57a40ff06cc371dff2d"}, + {file = "libtorrent-2.0.7-cp37-cp37m-win32.whl", hash = "sha256:b93c89186f0dcb0f785c135949e3e6106be722afcf4b1ed7e065e97da5d5fdd5"}, + {file = "libtorrent-2.0.7-cp37-cp37m-win_amd64.whl", hash = "sha256:0b997c9f2f363f75cb1deebf0de24397e1b750990c2642c22a948460d9dc17f1"}, + {file = "libtorrent-2.0.7-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d61a5775c1e405fef0f6b441308ff9522ba76a145e3f13e98d09dc572d7280a9"}, + {file = "libtorrent-2.0.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:9e1ae3010f8b604d6e5fcabf453b2694026eff506b29dca64ca49a86e8e4a264"}, + {file = "libtorrent-2.0.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe72fcac67d0ed28ce326f8b3fa0f153f7ff5b2183d829a960953474515986d4"}, + {file = "libtorrent-2.0.7-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:41ac59497c3a8c247e167da0f5e24898e726d12b110eb2cdcbe159e06a342b30"}, + {file = "libtorrent-2.0.7-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b5b682e5ee280d2b1c3704d76c35c8f769efcb19995e505818a4927a82c420ef"}, + {file = "libtorrent-2.0.7-cp38-cp38-win32.whl", hash = "sha256:0315b273ea6e1902c0559ba1350fe1b6beff1695587b699179183d92e9aab50b"}, + {file = "libtorrent-2.0.7-cp38-cp38-win_amd64.whl", hash = "sha256:d5f3cab75a9870a854c6e86b4b36869dee2abf5c43bc76a109f6019ad120a33c"}, + {file = "libtorrent-2.0.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1a43ceca91856e7296423fd29c31bd902bca47280425985bd4f04dd89ee5e902"}, + {file = "libtorrent-2.0.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4c315724d2226ead6852555d2776c905540186a3cd5fe6a504ad4fe9d3209132"}, + {file = "libtorrent-2.0.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a189a1f4bb1f1ab42cf4719f9a3bf115c574209f7603db1a9c12140ce619a439"}, + {file = "libtorrent-2.0.7-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:416ff05730735ddd158973c54ba996234992326d5a8528dc72ddf3772e75723f"}, + {file = "libtorrent-2.0.7-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0265fa3c215da96036c7aa44e9a89466f3ebb04dbc52e565fe1c5dc8e216d94b"}, + {file = "libtorrent-2.0.7-cp39-cp39-win32.whl", hash = "sha256:39707d5174ecb3f8f7e69d24109e004e32d836b98857db3e3ebfa7791e3880ca"}, + {file = "libtorrent-2.0.7-cp39-cp39-win_amd64.whl", hash = "sha256:96e8e7300a378e73e26edbe9974de8512ee951083ab38f50eadee33db9556410"}, +] +mypy = [ + {file = "mypy-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:701189408b460a2ff42b984e6bd45c3f41f0ac9f5f58b8873bbedc511900086d"}, + {file = "mypy-1.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fe91be1c51c90e2afe6827601ca14353bbf3953f343c2129fa1e247d55fd95ba"}, + {file = "mypy-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d26b513225ffd3eacece727f4387bdce6469192ef029ca9dd469940158bc89e"}, + {file = "mypy-1.2.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:3a2d219775a120581a0ae8ca392b31f238d452729adbcb6892fa89688cb8306a"}, + {file = "mypy-1.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:2e93a8a553e0394b26c4ca683923b85a69f7ccdc0139e6acd1354cc884fe0128"}, + {file = "mypy-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3efde4af6f2d3ccf58ae825495dbb8d74abd6d176ee686ce2ab19bd025273f41"}, + {file = "mypy-1.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:695c45cea7e8abb6f088a34a6034b1d273122e5530aeebb9c09626cea6dca4cb"}, + {file = "mypy-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d0e9464a0af6715852267bf29c9553e4555b61f5904a4fc538547a4d67617937"}, + {file = "mypy-1.2.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8293a216e902ac12779eb7a08f2bc39ec6c878d7c6025aa59464e0c4c16f7eb9"}, + {file = "mypy-1.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:f46af8d162f3d470d8ffc997aaf7a269996d205f9d746124a179d3abe05ac602"}, + {file = "mypy-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:031fc69c9a7e12bcc5660b74122ed84b3f1c505e762cc4296884096c6d8ee140"}, + {file = "mypy-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:390bc685ec209ada4e9d35068ac6988c60160b2b703072d2850457b62499e336"}, + {file = "mypy-1.2.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:4b41412df69ec06ab141808d12e0bf2823717b1c363bd77b4c0820feaa37249e"}, + {file = "mypy-1.2.0-cp37-cp37m-win_amd64.whl", hash = "sha256:4e4a682b3f2489d218751981639cffc4e281d548f9d517addfd5a2917ac78119"}, + {file = "mypy-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a197ad3a774f8e74f21e428f0de7f60ad26a8d23437b69638aac2764d1e06a6a"}, + {file = "mypy-1.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c9a084bce1061e55cdc0493a2ad890375af359c766b8ac311ac8120d3a472950"}, + {file = "mypy-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaeaa0888b7f3ccb7bcd40b50497ca30923dba14f385bde4af78fac713d6d6f6"}, + {file = "mypy-1.2.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bea55fc25b96c53affab852ad94bf111a3083bc1d8b0c76a61dd101d8a388cf5"}, + {file = "mypy-1.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:4c8d8c6b80aa4a1689f2a179d31d86ae1367ea4a12855cc13aa3ba24bb36b2d8"}, + {file = "mypy-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:70894c5345bea98321a2fe84df35f43ee7bb0feec117a71420c60459fc3e1eed"}, + {file = "mypy-1.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4a99fe1768925e4a139aace8f3fb66db3576ee1c30b9c0f70f744ead7e329c9f"}, + {file = "mypy-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:023fe9e618182ca6317ae89833ba422c411469156b690fde6a315ad10695a521"}, + {file = "mypy-1.2.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4d19f1a239d59f10fdc31263d48b7937c585810288376671eaf75380b074f238"}, + {file = "mypy-1.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:2de7babe398cb7a85ac7f1fd5c42f396c215ab3eff731b4d761d68d0f6a80f48"}, + {file = "mypy-1.2.0-py3-none-any.whl", hash = "sha256:d8e9187bfcd5ffedbe87403195e1fc340189a68463903c39e2b63307c9fa0394"}, + {file = "mypy-1.2.0.tar.gz", hash = "sha256:f70a40410d774ae23fcb4afbbeca652905a04de7948eaf0b1789c8d1426b72d1"}, +] +mypy-extensions = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] +packaging = [ + {file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"}, + {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"}, +] +pathspec = [ + {file = "pathspec-0.11.1-py3-none-any.whl", hash = "sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293"}, + {file = "pathspec-0.11.1.tar.gz", hash = "sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687"}, +] +platformdirs = [ + {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, + {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, +] +tomli = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] +typing-extensions = [ + {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, + {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7e6c6ca --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "magnet2torrent" +version = "0.1.0" +description = "Convert a magnet link into a torrent." +authors = ["hidden service "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +libtorrent = "^2.0.7" + +[tool.poetry.group.dev.dependencies] +black = "^23.3.0" +mypy = "^1.2.0" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..329a273 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +black==23.3.0 +click==8.1.3 +libtorrent==2.0.7 +mypy==1.2.0 +mypy-extensions==1.0.0 +packaging==23.0 +pathspec==0.11.1 +platformdirs==3.2.0 +tomli==2.0.1 +typing_extensions==4.5.0