35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
|
|
||
|
import argparse
|
||
|
def parse_args(argv =None):
|
||
|
parser = argparse.ArgumentParser()
|
||
|
# parser.add_argument('--access_token', type=str, help='Your mapillary access token')
|
||
|
parser.add_argument('--username', type=str, help='Username to get the sequences id of')
|
||
|
|
||
|
global args
|
||
|
args = parser.parse_args(argv)
|
||
|
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
parse_args()
|
||
|
|
||
|
username=args.username
|
||
|
input_file = f"sequences_{username}.txt"
|
||
|
output_file = f"script_bash_get_sequences_for_user_{username}.sh"
|
||
|
|
||
|
access_token = "--access_token=\"mly_token_A_REMPLACERRRRRRRRRRRR\" "
|
||
|
format_string = "python download.py {} --sequence_id={}\n"
|
||
|
|
||
|
|
||
|
with open(output_file, "w") as output:
|
||
|
with open(input_file, "r") as input_handle:
|
||
|
content = input_handle.read()
|
||
|
sequences = eval(content)
|
||
|
for seq in sequences:
|
||
|
full_cmd = f"python download.py {access_token} --sequence_id={seq} --username={username}\n"
|
||
|
output.write(full_cmd)
|
||
|
|
||
|
print(f"Script Bash généré : {output_file}")
|
||
|
|
||
|
print(output_file)
|