This commit is contained in:
qo-op 2020-05-03 02:17:09 +02:00
parent 93c59997bc
commit 8e80803b27
2 changed files with 2 additions and 55 deletions

View File

@ -1,53 +0,0 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
# TODO: SMS/SSB Alert when any gchange.fr ads is close to geopoint
#
# Extract last ads
# TODO Search ES with distance !!!! contact @kimamila or http://www.elasticsearchtutorial.com/spatial-search-tutorial.html
ipfsnodeid=$(ipfs id -f='<id>\n')
[[ ! -f ~/.ssb/secret.dunikey ]] && $MY_PATH/tools/secret2dunikey.sh
g1pub=$(cat ~/.ssb/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
CESIUM="https://g1.data.le-sou.org"
curl -sk ${CESIUM}/user/profile/${g1pub} -o /tmp/profile.json
LON=$(cat /tmp/profile.json | jq '._source.geoPoint.lon')
LAT=$(cat /tmp/profile.json | jq '._source.geoPoint.lat')
if [[ "$LON" != "null" ]]; then
curl -sk -XPOST 'https://data.gchange.fr/market/record/_search?pretty&_source=title' -d '
{
"size": 100,
"query": {
"bool": {
"filter": [{
"geo_distance": {
"distance": "100km",
"geoPoint": {
"lat": '$LAT',
"lon": '$LON'
}
}
}]
}
}
}' | jq
else
echo "Aucune coordonnées geoPoint pour $g1pub" && exit 1
fi
TOTAL=$(curl -s https://data.gchange.fr/market/record/_search | jq .hits.total)
echo "TOTAL ANNONCES GCHANGE: $TOTAL"
chunk=0
while [[ $chunk -lt $TOTAL ]]; do
for res in $(curl -s https://data.gchange.fr/market/record/_search?from=$chunk | jq .hits.hits[]._id | sed s/\"//g ) do;
echo $res;
# curl -s --create-dirs -o ./gchange/$ID.json -s https://data.gchange.fr/market/record/$ID?_source=category,title,description,issuer,time,creationTime,location,address,city,price,unit,currency,thumbnail._content_type,picturesCount,type,stock,fees,feesCurrency,geoPoint
done
chunk=$((chunk+10))
done

View File

@ -406,9 +406,9 @@ if [[ "${PASSENGERNAME}" != "" ]]; then
---
**ZEN=$ZEN($READ/$PARK)**
[:flying_saucer:Zen:heart:CONTRACT(s):file_folder:](http://127.0.0.1:8080/ipns/${J})
[:flying_saucer:Zen:heart:CONTRACT(s)_HERE:file_folder:](http://127.0.0.1:8080/ipns/${J})
[:sunglasses:**BLOB**:pager:](http://127.0.0.1:8080/ipns/$ipfsnodeid/.$ipfsnodeid/TAG/${ZENSOURCE})
[:sunglasses:**ZenTAG**:pager:](http://127.0.0.1:8080/ipns/$ipfsnodeid/.$ipfsnodeid/TAG/${ZENSOURCE})
#zenbot
#astroport