Skip to content

Commit

Permalink
Permet la récupération INAO
Browse files Browse the repository at this point in the history
  • Loading branch information
teymour committed Feb 8, 2023
1 parent 9550fc0 commit 308c6bb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions bin/download_parcellaire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ fi

CVI="$cvi" PRODOUANE_USER="$PRODOUANE_USER" PRODOUANE_PASS="$PRODOUANE_PASS" node puppeteer_scrapping/prodouane_parcellaire.js

if [ ! -f "./documents/parcellaire-${cvi}-parcellaire.html" ]; then
echo "Échec du scraping"
exit 4
if test -f "./documents/parcellaire-${cvi}-parcellaire.html"; then
sed -i '/^<?xml /id' "./documents/parcellaire-${cvi}-accueil.html"
sed -i '/^<?xml /id' "./documents/parcellaire-${cvi}-parcellaire.html"
python3 posttraitement/parcellaire_html_to_csv.py "$cvi" 2>&1
fi

sed -i '/^<?xml /id' "./documents/parcellaire-${cvi}-accueil.html"
sed -i '/^<?xml /id' "./documents/parcellaire-${cvi}-parcellaire.html"

python3 posttraitement/parcellaire_html_to_csv.py "$cvi" 2>&1

if ! test -f "documents/parcellaire-${cvi}.csv" && test -f "$INAO_FILE"; then
echo -n "Origine;CVI Operateur;Siret Operateur;Nom Operateur;Adresse Operateur;CP Operateur;Commune Operateur;Email Operateur;IDU;Commune;Lieu dit;Section;" > "documents/parcellaire-${cvi}.csv"
echo "Numero parcelle;Produit;Cepage;Superficie;Superficie cadastrale;Campagne;Ecart pied;Ecart rang;Mode savoir faire;Statut;Date MaJ" >> "documents/parcellaire-${cvi}.csv"
Expand All @@ -40,4 +36,9 @@ fi
#Code transitoire
if ! test -f "$INAO_FILE" && test -f "documents/parcellaire-${cvi}.csv" ; then
sed -i 's/^[^;]*;//' "documents/parcellaire-${cvi}.csv"
fi
fi

if ! test -f "documents/parcellaire-${cvi}.csv"; then
echo "Échec du scraping"
exit 4
fi

0 comments on commit 308c6bb

Please sign in to comment.