forked from axiom-team/astrXbian
getting p4n spots geodata
This commit is contained in:
parent
f67ff5b1d8
commit
eea656361c
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Author: Astrocrew
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
|
||||
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
|
||||
|
||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
|
||||
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "NO ~/.zen/secret.dunikey EXIT" && exit 1
|
||||
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n') && [[ ! $IPFSNODEID ]] && echo 'NO IPFS RUNNING. EXIT' && exit 1
|
||||
|
||||
## Backing up europa p4n collected from collective intelligence spots
|
||||
# PLAY bataille navale
|
||||
# Randomly get geaodata in longitude -10 to 30 / lat from 35 to 60 square
|
||||
lon=0
|
||||
lat=40
|
||||
while $(ls ~/.zen/ipfs_swarm/.*/astroport/$lat.$lon/p4n 2>/dev/null); do
|
||||
echo "astroport/$lat.$lon geodata already swarm captured. CONTINUE"
|
||||
FLOOR=-10;
|
||||
CEILING=30;
|
||||
RANGE=$(($CEILING-$FLOOR+1));
|
||||
RESULT=$RANDOM;
|
||||
let "RESULT %= $RANGE";
|
||||
lon=$(($RESULT+$FLOOR));
|
||||
#echo $lon
|
||||
|
||||
FLOOR=35;
|
||||
CEILING=60;
|
||||
RANGE=$(($CEILING-$FLOOR+1));
|
||||
RESULT=$RANDOM;
|
||||
let "RESULT %= $RANGE";
|
||||
lat=$(($RESULT+$FLOOR));
|
||||
#echo $lat
|
||||
done
|
||||
|
||||
### ADD Spot random
|
||||
# Add random ness
|
||||
one=$(echo "00$RANDOM$RANDOM$RANDOM" | cut -b1-12)
|
||||
latitude="$lat.$one"
|
||||
two=$(echo "00$RANDOM$RANDOM$RANDOM" | cut -b1-12)
|
||||
longitude="$lon.$two"
|
||||
|
||||
### SCRAPE P4N
|
||||
## Copy spot.json into astroport geodata directories
|
||||
echo "GETTING /astroport/map/$lat.$lon/p4n/spot.json"
|
||||
mkdir -p ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/
|
||||
echo "https://www.park4night.com/services/V3/getLieuxAroundMeLite.php?latitude=$latitude&longitude=$longitude"
|
||||
curl -s "https://www.park4night.com/services/V3/getLieuxAroundMeLite.php?latitude=$latitude&longitude=$longitude" -o ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/spot.json
|
||||
echo "SAVED ~/.zen/ipfs/.$IPFSNODEID/astroport/map/$lat.$lon/p4n/spot.json"
|
||||
# IPNS SELF PUBLISH = mise à jour balise Station
|
||||
########################################################################
|
||||
~/.zen/astrXbian/zen/ipns_self_publish.sh
|
||||
########################################################################
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue