diff --git a/zen/gchange_MONITOR.sh b/zen/gchange_MONITOR.sh index 41a2983..c8aaa62 100755 --- a/zen/gchange_MONITOR.sh +++ b/zen/gchange_MONITOR.sh @@ -45,6 +45,7 @@ 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 "> A $RAD de la [position](https://demo.cesium.app/#/app/wot/map) de mon [portefeuille](https://demo.cesium.app/#/app/wot/$g1pub/)" >> ~/.zen/cache/gchange.txt chunk=0 @@ -52,14 +53,15 @@ for gID in $(cat /tmp/gchange.json | jq -r .hits.hits[]._id); do [[ -f ~/.zen/ipfs_swarm/gchange/$gID.json ]] && INSWARM="true" NEW="" [[ ! -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,picturesCount,type,stock,fees,feesCurrency,geoPoint \ + && 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)) creationTime=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.creationTime) title=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.title) currency=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.currency) price=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.price) - [[ $price == null ]] && price="A débattre" + [[ $price == null ]] && price="A débattre" || price=$(bc -l <<< "scale=2; $price / 100") + categoryname=$(cat ~/.zen/cache/gchange/$gID.json | jq -r ._source.category.name) [[ $NEW == "true" ]] && echo "- [$title](https://data.gchange.fr/market/record/$gID/_share) PRIX $price ($currency)" >> ~/.zen/cache/gchange.txt && chunk=$((chunk+1))