GPS.json format adaptation

This commit is contained in:
fred 2024-03-07 18:59:59 +01:00
parent a323db6c82
commit 431d54d1ae
2 changed files with 6 additions and 4 deletions

View File

@ -55,8 +55,8 @@ rm ~/.zen/tmp/DRAGONS.json
if [[ ! -s ~/.zen/tmp/DRAGONS.json ]]; then
echo " ## cat ***/GPS.json"
cat ~/.zen/tmp/${IPFSNODEID}/GPS.json 2>/dev/null | jq -c '.[] + {ipfsnodeid: "'$IPFSNODEID'"}' > ~/.zen/tmp/${MOATS}/gps.grid
cat ~/.zen/tmp/swarm/12D*/GPS.json 2>/dev/null | jq -c '.[] + {ipfsnodeid: "'$IPFSNODEID'"}' | sort -u >> ~/.zen/tmp/${MOATS}/gps.grid
cat ~/.zen/tmp/${IPFSNODEID}/GPS.json 2>/dev/null | jq -c '. + {ipfsnodeid: "'$IPFSNODEID'"}' > ~/.zen/tmp/${MOATS}/gps.grid
cat ~/.zen/tmp/swarm/12D*/GPS.json 2>/dev/null | jq -c '. + {ipfsnodeid: "'$IPFSNODEID'"}' | sort -u >> ~/.zen/tmp/${MOATS}/gps.grid
cat ~/.zen/tmp/${MOATS}/gps.grid | jq -s '.' | sed -e 's/\[/[/' -e 's/\]/]/' -e 's/},{/},\n{/g' > ~/.zen/tmp/DRAGONS.json
fi

View File

@ -18,14 +18,16 @@ SECTOR=$2 ## Sector identifier _0.0_0.0
MOATS=$3 ## temp cache access
INDEX=$4 ## SECTOR TW index file
echo
[[ ! -s ${RSS} ]] && echo "BAD RSS INPUT" && exit 1
[[ "$(cat ${RSS})" == "[]" ]] && echo "EMPTY RSS " && exit 0
[[ ! -d ~/.zen/tmp/${MOATS}/${SECTOR}/ ]] && echo "BAD UPLANET CONTEXT" && exit 1
[[ ! -s ${INDEX} ]] \
&& sed "s~_SECTOR_~${SECTOR}~g" ${MY_PATH}/../templates/twsector.html > ${INDEX} \
&& echo "REFRESHING SECTOR FROM empty TEMPLATE *****"
echo
echo
## EXTRACT PLAYER FROM RSS FILE NAME
PLAYER=$(echo ${RSS} | rev | cut -d '/' -f 1 | rev | sed "s~.rss.json~~g")
## GET PLAYER INFORMATION