From da9e5bf6b53708f4237936d0f0804e6a705f4875 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 15 May 2017 05:21:52 +0200 Subject: [PATCH] Added getmanga ability to specify ad-hoc pattern on command-line. --- getmanga | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/getmanga b/getmanga index e6a9c96..f678e33 100755 --- a/getmanga +++ b/getmanga @@ -104,13 +104,14 @@ def download(mng, tdir, pattern): time.sleep(cwait) def usage(out): - out.write("usage: getmanga [-hv] [-w WAIT] [-p PROFILE] DIRECTORY [LIBRARY ID]\n") + out.write("usage: getmanga [-hv] [-w WAIT] [-p PROFILE] [-P PATTERN] DIRECTORY [LIBRARY ID]\n") def main(): global verbose, wait, mprof, props - opts, args = getopt.getopt(sys.argv[1:], "hvp:w:") + opts, args = getopt.getopt(sys.argv[1:], "hvp:w:P:") profnm = "" + pattern = None for o, a in opts: if o == "-h": usage(sys.stdout) @@ -121,6 +122,8 @@ def main(): verbose += 1 elif o == "-w": wait = int(a) + elif o == "-P": + pattern = a if len(args) < 1: usage(sys.stderr) sys.exit(1) @@ -167,7 +170,7 @@ def main(): sys.exit(1) mprof = profile.getmanga(libnm, mng.id) - download(mprof.open(), tdir, getprop("pattern")) + download(mprof.open(), tdir, pattern or getprop("pattern")) if __name__ == "__main__": try: -- 2.11.0