From 0ee156aaf31e4d9f7b138d1924a82f46bc9c0f8a Mon Sep 17 00:00:00 2001 From: Stefal Date: Fri, 15 Sep 2023 11:22:11 +0200 Subject: [PATCH] add argument to overwrite image --- download.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/download.py b/download.py index e9fa8bc..0696ff0 100644 --- a/download.py +++ b/download.py @@ -24,6 +24,7 @@ def parse_args(argv =None): parser.add_argument('--sequence_ids', type=str, nargs='+', help='The mapillary sequence id(s) to download') parser.add_argument('--access_token', type=str, help='Your mapillary access token') parser.add_argument('--image_limit', type=int, default=None, help='How many images you want to download') + parser.add_argument('--overwrite', type=bool, default = False, help='overwrite existing images') global args args = parser.parse_args(argv) @@ -144,5 +145,9 @@ if __name__ == '__main__': direction = image_data['compass_angle'], altitude = image_data['altitude'], ) + image_exists = os.path.exists(path) + if not args.overwrite and image_exists: + print("{} already exists. Skipping ".format(path)) + continue executor.submit(download, url=image_data['thumb_original_url'], filepath=path, metadata=img_metadata) #download(image_data['thumb_original_url'],path, img_metadata)