31 lines
606 B
Python
31 lines
606 B
Python
|
|
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)
|