if __name__ == '__main__': ''' Use from command line as: python upload.py path ''' if sys.version_info >= (3, 0): raise IOError("Incompatible Python version. This script requires Python 2.x, you are using {0}.".format( sys.version_info[:2])) parser = argparse.ArgumentParser( description='Upload photos taken with Mapillary apps') parser.add_argument('path', help='path to your photos') parser.add_argument('--upload_subfolders', help='option to upload subfolders', action='store_true') args = parser.parse_args() path = args.path skip_subfolders = not args.upload_subfolders s = Sequence(path, skip_folders=[ 'success', 'duplicates'], skip_subfolders=skip_subfolders, check_exif=False) num_image_file = len(s.file_list) file_list = [f for f in s.file_list if verify_mapillary_tag(f)] print("Uploading {} images with valid mapillary tags (Skipping {})".format( len(file_list), num_image_file - len(file_list))) upload_file_list(file_list) print("Done uploading {} images.".format(len(file_list)))
if len(s.file_list) == 0: print("No images in the folder or all images have all ready been uploaded to Mapillary") print( 'Note: If upload fails mid-sequence due to connection failure or similar, you should manually push the images to the server at http://www.mapillary.com/map/upload/im/ and pressing "push to Mapillary".' ) sys.exit() print("Uploading sequence {0}.".format(sequence_id)) # check mapillary tag and required exif file_list = [] for filepath in s.file_list: mapillary_tag_exists = EXIF(filepath).mapillary_tag_exists() if mapillary_tag_exists: print("File {} contains Mapillary EXIF tags, use upload.py instead.".format(filepath)) required_exif_exist = verify_exif(filepath) if not required_exif_exist: print("File {} missing required exif".format(filepath)) if required_exif_exist and (not mapillary_tag_exists): file_list.append(filepath) # upload valid files upload_file_list(file_list, params) # ask user if finalize upload to check that everything went fine print( "===\nFinalizing upload will submit all successful uploads and ignore all failed.\nIf all files were marked as successful, everything is fine, just press 'y'." ) finalize_upload(params)
print 'Uploading sequence {} to {}'.format( str(sequence_uuid), s3_bucket) # set upload parameters params = { "url": MAPILLARY_UPLOAD_URL, "key": s3_bucket, "permission": MAPILLARY_PERMISSION_HASH, "signature": MAPILLARY_SIGNATURE_HASH, "move_files": MOVE_FILES, "keep_file_names": False } # Upload images total_uploads += len(file_list) upload_file_list(file_list, params) # A short summary of the uploads s = Sequence(path) lines = upload_summary(file_list, total_uploads, split_groups, duplicate_groups, missing_groups) print('\n========= Summary of your uploads ==============') print lines print("==================================================") print( "You can now preview your uploads at http://www.mapillary.com/map/upload/im" ) # Finalizing the upload by uploading done files for all sequence if not skip_upload:
help='option to upload subfolders', action='store_true') parser.add_argument( '--delete_after_upload', help= 'option to delete images after they have been successfully uploaded', action='store_true') args = parser.parse_args() path = args.path skip_subfolders = not args.upload_subfolders s = Sequence(path, skip_folders=['success'], skip_subfolders=skip_subfolders, check_exif=False) num_image_file = len(s.file_list) file_list = [f for f in s.file_list if verify_mapillary_tag(f)] print("Uploading {} images with valid mapillary tags (Skipping {})".format( len(file_list), num_image_file - len(file_list))) if args.delete_after_upload is True: delete_after_upload = 1 else: delete_after_upload = 0 upload_file_list(file_list, delete_after_upload) print("Done uploading {} images.".format(len(file_list)))
''' Usage: python upload.py [--upload_subfolders] [--delete_after_upload] path ''' if sys.version_info >= (3, 0): raise IOError("Incompatible Python version. This script requires Python 2.x, you are using {0}.".format(sys.version_info[:2])) parser = argparse.ArgumentParser(description='Upload photos taken with Mapillary apps') parser.add_argument('path', help='path to your photos from the Mapillary app') parser.add_argument('--upload_subfolders', help='option to upload subfolders', action='store_true') parser.add_argument('--delete_after_upload', help='option to delete images after they have been successfully uploaded', action='store_true') args = parser.parse_args() path = args.path skip_subfolders = not args.upload_subfolders s = Sequence(path, skip_folders=['success'], skip_subfolders=skip_subfolders, check_exif=False) num_image_file = len(s.file_list) file_list = [f for f in s.file_list if verify_mapillary_tag(f)] print ("Uploading {} images with valid mapillary tags (Skipping {})".format(len(file_list), num_image_file-len(file_list))) if args.delete_after_upload is True: delete_after_upload = 1; else: delete_after_upload = 0; upload_file_list(file_list, delete_after_upload) print("Done uploading {} images.".format(len(file_list)))
THE MAPILLARY APPS, WITHOUT PROPER TOKENS IN EXIF, UPLOADED FILES WILL BE IGNORED SERVER-SIDE. ''' if __name__ == '__main__': ''' Use from command line as: python upload.py path ''' if sys.version_info >= (3, 0): raise IOError("Incompatible Python version. This script requires Python 2.x, you are using {0}.".format(sys.version_info[:2])) if len(sys.argv) > 2: print("Usage: python upload.py path") raise IOError("Bad input parameters.") path = sys.argv[1] s = Sequence(path, skip_folders=['success'], check_exif=False) num_image_file = len(s.file_list) file_list = [f for f in s.file_list if verify_mapillary_tag(f)] print ("Uploading {} images with valid mapillary tags (Skipping {})".format(len(file_list), num_image_file-len(file_list))) upload_file_list(file_list) print("Done uploading {} images.".format(len(file_list)))
Intended use is for cases when you have multiple SD cards or for other reasons have copied the files to a computer and you want to bulk upload. NB: DO NOT USE THIS ON OTHER IMAGE FILES THAN THOSE FROM THE MAPILLARY APPS, WITHOUT PROPER TOKENS IN EXIF, UPLOADED FILES WILL BE IGNORED SERVER-SIDE. ''' if __name__ == '__main__': ''' Use from command line as: python upload.py path ''' if sys.version_info >= (3, 0): raise IOError("Incompatible Python version. This script requires Python 2.x, you are using {0}.".format(sys.version_info[:2])) if len(sys.argv) > 2: print("Usage: python upload.py path") raise IOError("Bad input parameters.") path = sys.argv[1] s = Sequence(path, skip_folders=['success']) upload_file_list(s.file_list) print("Done uploading {} images.".format(len(s.file_list)))