mapillary_download/batch_get_username.sh
2025-07-28 12:15:43 +02:00

58 lines
2.1 KiB
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# récupérer les séquences pour un tas d'utilisateurs
# Liste des usernames
# example:
# usernames=( "riri" "fifi" "loulou")
#usernames=( "irgaresh1" "albanmorlot" "zaneo" "bernardvoyageur" "pelderson" "emerzh" "donlouba")
#usernames=("tedscougv" "gaptpro" "zlplhr" "derfred" "reisender" "jonnymccullagh" "jasskurn" "yopaseopor") # keep it empty to be asked each time you run the script which account to export
#usernames=("raymond")
#usernames=("thierry1030" "konink360")
#usernames=("didier2020") # et aussi deleted_user
#usernames=("alainproviste")
#usernames=("ratzillas") # et tdelmas
#usernames=("niquarl")
#usernames=("cyrillelargillier")
usernames=()
if test -z $usernames; then
read -p "Please enter a mapillary username: " ANS
usernames=$ANS
fi
# check env variables are valid
if [ -f "secrets_variables.sh" ]; then
source "secrets_variables.sh"
if [ "$MAPILLARY_DEV_TOKEN" = "MLY|blahblah_replace_it" ]; then
echo "Erreur : La variable MAPILLARY_DEV_TOKEN doit être modifiée pour que le script fonctionne."
echo "Veuillez remplacer la valeur par défaut \"MLY|blahblah_replace_it\" par votre propre token de développement Mapillary."
exit 1
fi
else
echo "Erreur : Le fichier secrets_variables.sh n'a pas été trouvé."
exit 1
fi
# Boucle sur la liste des usernames
for username in "${usernames[@]}"; do
# Lancer la commande pour chaque username
echo "---------- utilisateur: $username"
if [ ! -f "out_$username.json" ]; then
bash find_user_id.sh $username
fi
# Vérifier si le fichier sequences_$username.txt existe
if [ ! -f "sequences_$username.txt" ]; then
python3 get_sequences_of_username.py --username="$username" --dev_token="$MAPILLARY_DEV_TOKEN" --max_sequence=9999
else
echo "le fichier sequences txt existe pour $username"
fi
# Lancer la commande pour chaque username
if [ ! -f "script_bash_get_sequences_for_user_$username.sh" ]; then
python3 text_array_to_download_script.py --username=$username --dev_token="$MAPILLARY_DEV_TOKEN"
fi
done
echo "---------- finished getting users ------------"