Ajouter sa géolocalisation dans Cesium+ permet de voir les annonces à 10km autour de chez soi...
This commit is contained in:
parent
839e2c3bb6
commit
21b9a1f702
|
@ -178,7 +178,7 @@ fi
|
|||
##################################################################
|
||||
############ ASTROPORT LAUNCHING DATE 12:12 (HOUR is UTC)
|
||||
TODAY=$(date -u '+%Y%m%d')
|
||||
if [[ "$timebar" == "10:12" && "$TODAY" == "20200606" ]]; then
|
||||
if [[ "$timebar" == "10:12" ]]; then
|
||||
echo '
|
||||
_____ ___ ___ __ __ _
|
||||
|__ / |__ \ < / / /___ ___ ______ _____/ /_ (_)___ ____ _
|
||||
|
@ -188,9 +188,9 @@ echo '
|
|||
/____/
|
||||
ASTROPORT NOW... automate cellulaire - blob à rétrocontrole humain COLLECTIVE INIT
|
||||
'
|
||||
echo "$TODAY 12:12 - OFFICIAL BETA TESTING"
|
||||
echo "$TODAY 12:12 - GCHANGE MARKET 10km SCAN"
|
||||
sleep $((1 + RANDOM % 10))
|
||||
$MY_PATH/zen/ssb_INIT.sh
|
||||
$MY_PATH/zen/gchange_MONITOR.sh
|
||||
fi
|
||||
##################################################################
|
||||
##################################################################
|
||||
|
|
|
@ -44,15 +44,17 @@ curl -sk -XPOST 'https://data.gchange.fr/market/record/_search?pretty&_source=ti
|
|||
}
|
||||
}' > /tmp/gchange.json || exit 1
|
||||
else
|
||||
echo "Aucune coordonnées geoPoint pour $g1pub" && exit 1
|
||||
echo "Aucune coordonnées geoPoint pour $g1pub"
|
||||
sbotc publish '{"type":"post","text":"Ajouter sa géolocalisation dans Cesium+ permet de voir les annonces à 10km autour de chez soi..."}'
|
||||
exit 1
|
||||
fi
|
||||
TIMEBEFORE=$(date -u --date="-$DELAY" +"%s")
|
||||
TIMESTAMP=$(date -u +"%s")
|
||||
TOTAL=$(cat /tmp/gchange.json | jq .hits.total)
|
||||
echo 'tail -f ~/.zen/cache/gchange.txt'
|
||||
echo '# #GCHANGE-Market' > ~/.zen/cache/gchange.txt
|
||||
echo "Le profil géolocalisé de ce [portefeuille](https://demo.cesium.app/#/app/wot/$g1pub/)" >> ~/.zen/cache/gchange.txt
|
||||
echo "reçoit les annonces [situées dans un rayon de $RAD](https://www.openstreetmap.org/#map=10/$LAT/$LON) " >> ~/.zen/cache/gchange.txt
|
||||
echo 'Mes_annonces_ghange' > ~/.zen/cache/gchange.txt
|
||||
echo "Mon_portefeuille_June_[:heart:](https://demo.cesium.app/#/app/wot/$g1pub/)" >> ~/.zen/cache/gchange.txt
|
||||
echo "Mes_annonces_à_[$RAD](https://www.openstreetmap.org/#map=10/$LAT/$LON) " >> ~/.zen/cache/gchange.txt
|
||||
chunk=0
|
||||
fullcount=0
|
||||
|
||||
|
@ -66,12 +68,15 @@ for gID in $(cat /tmp/gchange.json | jq -r .hits.hits[]._id); do
|
|||
|
||||
NEW=""
|
||||
|
||||
#[[ ! -f ~/.zen/cache/gchange/$gID.json ]] &&
|
||||
[[ ! -f ~/.zen/cache/gchange/$gID.json ]] &&
|
||||
NEW="true" \
|
||||
&& curl -s --create-dirs -o ~/.zen/cache/gchange/$gID.json -s https://data.gchange.fr/market/record/$gID?_source=category,title,description,issuer,time,creationTime,location,address,city,price,unit,currency,thumbnail._content_type,thumbnail._content,picturesCount,type,stock,fees,feesCurrency,geoPoint \
|
||||
&& sleep $((1 + RANDOM % 3))
|
||||
|
||||
type=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.type)
|
||||
stock=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.stock)
|
||||
[[ $stock == 0 ]] && continue
|
||||
|
||||
# [[ $type == "need" ]] && continue
|
||||
creationTime=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.creationTime)
|
||||
title=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.title)
|
||||
|
@ -83,22 +88,26 @@ for gID in $(cat /tmp/gchange.json | jq -r .hits.hits[]._id); do
|
|||
|
||||
[[ $price == null ]] && price="0"
|
||||
[[ $currency == "g1" ]] && love=$(bc -l <<< "scale=2; $price / $LASTDU * 100") || love="?.??"
|
||||
love="$love LOVE"
|
||||
love="$love_LOVE"
|
||||
price=$(bc -l <<< "scale=2; $price / 100")
|
||||
|
||||
fullcount=$((fullcount+1)) && echo "DEBUG : $fullcount - $type - $price $currency - $title "
|
||||
[[ $price == "0" ]] && love="OFFERT !?" && price="A débattre "
|
||||
[[ $price == "0" ]] && love="..." && price="A débattre "
|
||||
|
||||
|
||||
[[ $NEW == "true" ]] \
|
||||
&& echo "- [$title](https://data.gchange.fr/market/record/$gID/_share) :heart: $love" >> ~/.zen/cache/gchange.txt \
|
||||
&& chunk=$((chunk+1)) && echo $chunk
|
||||
[[ $type == "offer" ]] && LINE="___OFFRE___[$title](https://data.gchange.fr/market/record/$gID/_share)_$love"
|
||||
[[ $type == "need" ]] && LINE="__DEMANDE__[$title](https://data.gchange.fr/market/record/$gID/_share)_$love"
|
||||
|
||||
[[ $NEW == "true" ]] && echo "$LINE" >> ~/.zen/cache/gchange.txt && chunk=$((chunk+1)) && echo $chunk
|
||||
|
||||
done
|
||||
echo "$chunk nouvelles annonces ($TOTAL)" >> ~/.zen/cache/gchange.txt
|
||||
echo "$chunk_nouvelles_annonces_($TOTAL)" >> ~/.zen/cache/gchange.txt
|
||||
|
||||
## TODO AUTOMATIC PUBLISHING \n and message size problem ??
|
||||
# sbotc publish '{"type":"post","text":"'"$(cat ~/.zen/cache/gchange.txt)"'"}'
|
||||
|
||||
if [[ $(cat ~/.zen/cache/gchange.txt | wc -c) -lt 8000 ]]; then
|
||||
export raw="$(cat ~/.zen/cache/gchange.txt)"
|
||||
annonces=$(node -p "JSON.stringify(process.env.raw)")
|
||||
sbotc publish '{"type":"post","text":'$annonces'}'
|
||||
fi
|
||||
# EXTRA COULD CREATE IT'S OWN MAP with https://github.com/zicmama/tile-stitch.git
|
||||
# And magick to overlay... But best would be a local map proxy...
|
||||
|
|
Loading…
Reference in New Issue