From 42295b7b0ac18c4ad6a28396e04802fb22031549 Mon Sep 17 00:00:00 2001 From: Evgeny Sorokin Date: Wed, 26 Jun 2024 01:31:28 +0300 Subject: add --skip-pages argument --- main.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'main.py') diff --git a/main.py b/main.py index db0c80e..0a2662b 100755 --- a/main.py +++ b/main.py @@ -76,11 +76,16 @@ if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('--uuid', type=str, required=True) parser.add_argument('--output-dir', type=str, required=True) + parser.add_argument('--skip-pages', type=int, default=0, + help='number of pages to skip') args = parser.parse_args() m = fetch_manifest(args.uuid) page = 0 for c in m['sequences'][0]['canvases']: + if args.skip_pages != 0 and page < args.skip_pages: + page += 1 + continue download_and_merge_image(c['width'], c['height'], extract_uuid(c['@id']), os.path.join(args.output_dir, f'{page}.jpg')) print(f'{page} done') page += 1 -- cgit v1.2.3