From 61a4cffa4f4877a18adb72b88f93e8bb3a14dc79 Mon Sep 17 00:00:00 2001 From: qo-op Date: Sun, 19 Apr 2020 19:09:29 +0200 Subject: [PATCH] better G1 timestamp precision --- zen/g1_MONITOR_zen.sh | 44 ++++++++++++++++++++++++++++++------------- zen/ssb_GET_zenyta.sh | 2 +- zen/ssb_GET_zenytv.sh | 2 +- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/zen/g1_MONITOR_zen.sh b/zen/g1_MONITOR_zen.sh index b25ed96..81c1862 100755 --- a/zen/g1_MONITOR_zen.sh +++ b/zen/g1_MONITOR_zen.sh @@ -30,8 +30,8 @@ echo " " DELAY="$1" -IPFSNODEID=$(ipfs id -f='\n') -[[ $IPFSNODEID == "" ]] && echo "$USER Please Install IPFS !!" && exit 1 +ipfsnodeid=$(ipfs id -f='\n') +[[ "$ipfsnodeid" == "" ]] && echo "$USER Please Install IPFS !!" && exit 1 [[ ! -d ~/.zen/cache/g1_TX_inputs ]] && mkdir -p ~/.zen/cache/g1_TX_inputs # Directory containing G1 blockchain incoming TX Scan [[ ! -d ~/.zen/ipfs ]] && mkdir -p ~/.zen/ipfs # Directory where NODE store SMS & other Channel Wallets [[ ! -d ~/.zen/ipfs_swarm ]] && mkdir -p ~/.zen/ipfs_swarm # Local copy of all SSB friends IPFS Nodes published ipfs @@ -61,7 +61,7 @@ fi ######################################################################################################### echo "=======================================" -echo "IPFS Node ID = $IPFSNODEID +echo "IPFS Node ID = $ipfsnodeid __ _|_ _ _| |\ | _ _| _ /__/| _.|| __|_ (_| |(/_(_|< | \|(_)(_|(/_ \_| | \/\/(_|||(/_|_ @@ -96,7 +96,7 @@ if [[ $DELAYUNIT != "minutes" && $DELAYUNIT != "minute" ]]; then # HOW MANY TX DO WE HAVE... TXnb=$(cat /tmp/g1_TX.scan.txt | jq '.history.received[].hash' | wc -l) - echo "DETECTED $TXnb TX... Checking TX/IN..." + echo "During $DELAY, detected $TXnb TX... Now looking for INPUT TX..." # PARSE $TXnb TX line=1 while [[ $line -le $TXnb ]]; do @@ -122,11 +122,20 @@ ___ ___ _ ___ _ |/\ _|_| \|| |_|| | \(/_(_(/_|\/(/_(_| " -# Add CASE for received here - ###### CREATE ZEN VALUE IN IPFS ######### - [[ $CMD == "ZEN" ]] && $MY_PATH/zen_MAKE.sh $ZEN $TXhash - ############################################ + case "$CMD" in + + ZEN) + # Create ZenTAG QRCode + $MY_PATH/zen_MAKE.sh $ZEN $TXhash + ;; + + *) + echo "$TXhash = $ZEN ZEN" + # $MY_PATH/zen_MAKE.sh "ME" $TXhash + ;; + + esac fi ((line++)) @@ -139,7 +148,7 @@ else # MINUTE DELAY = pending // TODO: if anyone succeed in passing $VAR in jq command, both can be merge... # HOW MANY TX DO WE HAVE... TXnb=$(cat /tmp/g1_TX.scan.txt | jq '.history.pending[].hash' | wc -l) - echo "DETECTED $TXnb TX... Checking TX/IN..." + echo "During $DELAY, detected $TXnb TX... Now looking for INPUT TX..." # PARSE $TXnb TX line=1 while [[ $line -le $TXnb ]]; do @@ -164,12 +173,21 @@ ___ ___ _ ___ _ |/\ _|_| \|| |_|| | (/_| |(_||| |(_| _| " -# Add CASE for pending here - ###### CREATE ZEN VALUE IN IPFS ######### - [[ $CMD == "ZEN" ]] && $MY_PATH/zen_MAKE.sh $ZEN $TXhash - ############################################ + case "$CMD" in + ZEN) + # Create ZenTAG QRCode + $MY_PATH/zen_MAKE.sh $ZEN $TXhash + ;; + + *) + echo "$TXhash = $ZEN ZEN" + # $MY_PATH/zen_MAKE.sh "ME" $TXhash + ;; + + esac + fi ((line++)) done diff --git a/zen/ssb_GET_zenyta.sh b/zen/ssb_GET_zenyta.sh index 6a09a9f..db7ac92 100755 --- a/zen/ssb_GET_zenyta.sh +++ b/zen/ssb_GET_zenyta.sh @@ -83,7 +83,7 @@ do --no-mtime -o "~/.zen/miam/$timestamp/%(id)s.%(ext)s" $msg_ytdlurl # REFERENCE msg_key AND timestamp - [[ $timestamp ]] && echo "$timestamp" > ~/.zen/zenyta.last.ts + [[ $timestamp ]] && echo "$((timestamp + 1))" > ~/.zen/zenyta.last.ts [[ $msg_key ]] && echo "$msg_key" > ~/.zen/miam/$timestamp/msg_key done < <(printf '%s\n' "$messages") diff --git a/zen/ssb_GET_zenytv.sh b/zen/ssb_GET_zenytv.sh index bfaf36f..fb52d5d 100755 --- a/zen/ssb_GET_zenytv.sh +++ b/zen/ssb_GET_zenytv.sh @@ -83,7 +83,7 @@ do --no-mtime -o "~/.zen/miam/$timestamp/%(id)s.%(ext)s" $msg_ytdlurl # REFERENCE msg_key AND timestamp - [[ $timestamp ]] && echo "$timestamp" > ~/.zen/zenytv.last.ts + [[ $timestamp ]] && echo "$((timestamp + 1))" > ~/.zen/zenytv.last.ts [[ $msg_key ]] && echo "$msg_key" > ~/.zen/miam/$timestamp/msg_key done < <(printf '%s\n' "$messages")