added output directory option
This commit is contained in:
parent
3ec002c8eb
commit
7fee1501ab
5
main.py
5
main.py
|
@ -1,12 +1,14 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import mangadex
|
import mangadex
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
|
|
||||||
argparser = argparse.ArgumentParser()
|
argparser = argparse.ArgumentParser()
|
||||||
argparser.add_argument("url", help="the manga URL. Can be a mangadex chapter (/chapter/) or manga series (/title/) URL.")
|
argparser.add_argument("url", help="the manga URL. Can be a mangadex chapter (/chapter/) or manga series (/title/) URL.")
|
||||||
argparser.add_argument("-l","--language", help="the language code to download chapters in. Only relevent to series URLs.", default=None)
|
argparser.add_argument("-l","--language", help="the language code to download chapters in. Only relevent to series URLs.", default=None)
|
||||||
argparser.add_argument("-c","--chapterrange", help="the range of chapters to download, in \"start,end\" format. Only relevent to manga series URLs.", default=None)
|
argparser.add_argument("-c","--chapterrange", help="the range of chapters to download, in \"start,end\" format. Only relevent to manga series URLs.", default=None)
|
||||||
argparser.add_argument("-g","--group", help="the transation group to download chapters from. This is a group ID not a group name. Only relevent to manga series URLs.", default=None)
|
argparser.add_argument("-g","--group", help="the transation group to download chapters from. This is a group ID not a group name. Only relevent to manga series URLs.", default=None)
|
||||||
|
argparser.add_argument("-o","--output", help="output directory", default=None)
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
split_url = args.url.split("/")
|
split_url = args.url.split("/")
|
||||||
|
@ -17,6 +19,9 @@ if args.chapterrange != None:
|
||||||
else:
|
else:
|
||||||
crange = None
|
crange = None
|
||||||
|
|
||||||
|
if args.output != None:
|
||||||
|
os.chdir(args.output)
|
||||||
|
|
||||||
for t in range(len(split_url)):
|
for t in range(len(split_url)):
|
||||||
if split_url[t] == "chapter":
|
if split_url[t] == "chapter":
|
||||||
mangadex.save_chapter(split_url[t+1])
|
mangadex.save_chapter(split_url[t+1])
|
||||||
|
|
Reference in New Issue