reduce ipfs get $IPNSL requests
This commit is contained in:
parent
8f153339ee
commit
331b4d8903
|
@ -151,10 +151,11 @@ echo "##########################################################################
|
||||||
|
|
||||||
# qo-op get latest history.json
|
# qo-op get latest history.json
|
||||||
if [[ "$(cat ~/.zen/bunkerbox/choice 2>/dev/null)" == "qo-op" ]]; then
|
if [[ "$(cat ~/.zen/bunkerbox/choice 2>/dev/null)" == "qo-op" ]]; then
|
||||||
|
[[ $(cat ~/.zen/bunkerbox/history_qo-op.json | jq .Videos[].link | grep $VUID) ]] && echo "VIDEO DEJA LOCALE... CONTINUE" && continue
|
||||||
IPNSL="/ipns/$(ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ')"
|
IPNSL="/ipns/$(ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ')"
|
||||||
ipfs get -o ~/.zen/bunkerbox/history_qo-op.json $IPNSL/history.json # Get actual IPNS qo-op history.json
|
ipfs get -o ~/.zen/bunkerbox/history_qo-op.json $IPNSL/history.json # Get actual IPNS qo-op history.json
|
||||||
[[ ! -f ~/.zen/bunkerbox/history_qo-op.json || $(cat ~/.zen/bunkerbox/history_qo-op.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/history.json ~/.zen/bunkerbox/history_qo-op.json
|
[[ ! -f ~/.zen/bunkerbox/history_qo-op.json || $(cat ~/.zen/bunkerbox/history_qo-op.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/history.json ~/.zen/bunkerbox/history_qo-op.json
|
||||||
[[ $(cat ~/.zen/bunkerbox/history_qo-op.json | jq .Videos[].link | grep $VUID) ]] && echo "VIDEO DEJA DANS IPFS... CONTINUE" && echo && cp ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json && continue
|
[[ $(cat ~/.zen/bunkerbox/history_qo-op.json | jq .Videos[].link | grep $VUID) ]] && echo "VIDEO DEJA DANS LE RESEAU... CONTINUE" && echo && cp ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json && continue
|
||||||
# JSON FUSION
|
# JSON FUSION
|
||||||
jq -s '.[0] * .[1]' ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json | jq -M '.Videos |= unique_by(.link)' > ~/.zen/bunkerbox/history.fusion.json
|
jq -s '.[0] * .[1]' ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json | jq -M '.Videos |= unique_by(.link)' > ~/.zen/bunkerbox/history.fusion.json
|
||||||
mv ~/.zen/bunkerbox/history.fusion.json ~/.zen/bunkerbox/history.json ## REPLACE LOCAL HISTORY CACHE
|
mv ~/.zen/bunkerbox/history.fusion.json ~/.zen/bunkerbox/history.json ## REPLACE LOCAL HISTORY CACHE
|
||||||
|
|
Loading…
Reference in New Issue