Added support for Magnets!
This commit is contained in:
parent
ca73445114
commit
ea50300c14
@ -52,12 +52,11 @@ while you're in the /inc folder (or any folder below there)
|
|||||||
def main():
|
def main():
|
||||||
inf = json.loads(sys.argv[1])
|
inf = json.loads(sys.argv[1])
|
||||||
url = inf["txt"]
|
url = inf["txt"]
|
||||||
if "://" not in url:
|
if "://" not in url and url[:6] != 'magnet':
|
||||||
url = "https://" + url
|
url = "https://" + url
|
||||||
|
proto = url.split("://")[0].lower()
|
||||||
proto = url.split("://")[0].lower()
|
if proto not in ("http", "https", "ftp", "ftps"):
|
||||||
if proto not in ("http", "https", "ftp", "ftps"):
|
raise Exception("bad proto {}".format(proto))
|
||||||
raise Exception("bad proto {}".format(proto))
|
|
||||||
|
|
||||||
os.chdir(inf["ap"])
|
os.chdir(inf["ap"])
|
||||||
|
|
||||||
@ -73,13 +72,16 @@ def main():
|
|||||||
"--downloader-args", "-j 16 -x 8 -s 16 -k 1M",
|
"--downloader-args", "-j 16 -x 8 -s 16 -k 1M",
|
||||||
url
|
url
|
||||||
]
|
]
|
||||||
|
print(url[:6])
|
||||||
|
if url[:6] == 'magnet':
|
||||||
|
cmd = [cmd[4]] + [cmd[7]]
|
||||||
|
|
||||||
if '.' in (name[-3], name[-4]) and name[-3:] != 'php':
|
else:
|
||||||
cmd += ["-o", name]
|
if '.' in (name[-3], name[-4]) and name[-3:] != 'php':
|
||||||
|
cmd += ["-o", name]
|
||||||
|
|
||||||
print(" ".join(cmd) + "\n", end="")
|
print(" ".join(cmd) + "\n", end="")
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, text=True)
|
result = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, text=True)
|
||||||
print("STDOUT:\n" + result.stdout)
|
print("STDOUT:\n" + result.stdout)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user