added output directory option

This commit is contained in:
nihilazo 2018-12-23 16:39:30 +00:00
parent 3ec002c8eb
commit 7fee1501ab
1 changed files with 5 additions and 0 deletions

View File

@ -1,12 +1,14 @@
#!/usr/bin/python
import mangadex
import argparse
import os
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("-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("-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()
split_url = args.url.split("/")
@ -17,6 +19,9 @@ if args.chapterrange != None:
else:
crange = None
if args.output != None:
os.chdir(args.output)
for t in range(len(split_url)):
if split_url[t] == "chapter":
mangadex.save_chapter(split_url[t+1])