From 8159244f8d5f173ee6611f8a5ff4a1ea4d127455 Mon Sep 17 00:00:00 2001 From: Ryszard Knop Date: Sun, 3 Oct 2021 13:28:24 +0200 Subject: [PATCH] Use argparse to convert continue_from to int --- downloader.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/downloader.py b/downloader.py index 44e04bb..58cd2be 100755 --- a/downloader.py +++ b/downloader.py @@ -291,20 +291,12 @@ if __name__ == "__main__": parser.add_argument("entries", help="path to the game jam entries.json file") parser.add_argument("--api-key", metavar="key", required=True, help="itch.io API key from https://itch.io/user/settings/api-keys") parser.add_argument("--download-to", metavar="path", help="directory to save results into (default: current dir)") - parser.add_argument("--continue-from", metavar="id", help="skip all entries until the provided entry ID is found") + parser.add_argument("--continue-from", metavar="id", type=int, help="skip all entries until the provided entry ID is found") args = parser.parse_args() - continue_id = args.continue_from - if continue_id is not None: - try: - continue_id = int(continue_id) - except: - print("ID to continue from must be an integer.") - exit(1) - download_to = os.getcwd() if args.download_to is not None: download_to = os.path.normpath(args.download_to) os.makedirs(download_to) - download_jam(args.entries, download_to, args.api_key, continue_from=continue_id) + download_jam(args.entries, download_to, args.api_key, continue_from=args.continue_from)