_TSVUID_ replace

This commit is contained in:
fred 2022-07-01 16:34:43 +02:00
parent 920b2ba704
commit 5df729f2a7
1 changed files with 12 additions and 5 deletions

View File

@ -7,8 +7,14 @@
mkdir -p ~/.zen/bunkerbox # BunkerBOX temp directory
# Fred MadeInZion, [20/03/2022 23:03]
# Script qui capture et transfert dans IPFS le flux des nouvelles vidéos de https://crowdbunker.com/
# le resultat est inscrit dans une chaine video accessible localement ou publiée au travers de qo-op
# ou du TestNET astrXbian, videoclub entre amis d'amis...
# le resultat est inscrit dans une chaine video accessible localement ou publiée au travers de la clef paratgée entre toutes les station scraper "qo-op"
# ~/.zen/bunkerbox/ contient les fichiers publiés sur le CDN
# ~/.zen/bunkerbox/cache/$VUID/media (cache de la copie)
# ~/.zen/bunkerbox/history.json et history_${hier}.json permettent de parcourir les captures de chaque jour
# ~/.zen/bunkerbox/history_qo-op.json : Historique diffusé actuellement par 'qo-op'
# ~/.zen/bunkerbox/history.${CHANNEL}.json : Historique des channels crowdbunker
# ~/.zen/bunkerbox/homepage/ : Zone de publication des fichiers publiés sur "qo-op"
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
@ -170,13 +176,14 @@ echo "##########################################################################
## NO OR EMPTY HISTORY? COPY from TEMPLATE (PROGRAM START)
[[ ! -f ~/.zen/bunkerbox/history.json || $(cat ~/.zen/bunkerbox/history.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/history.json ~/.zen/bunkerbox/history.json
# get latest history.json publishes with (shared?) 'qo-op' IPNS key
# get latest history.json. Please publish with conscienciously privately shared 'qo-op' IPNS key.
# Use DNSLink to integrate into your DNS plan
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 DANS LE CACHE... CONTINUE" && continue
IPNS="$(ipfs key list -l | grep -w 'qo-op' | cut -f 1 -d ' ')"
IPNSL="/ipns/$IPNS"
ipfs get -o ~/.zen/bunkerbox/history_qo-op.json $IPNSL/history.json # Get actual IPNS qo-op history.json
# Missing file... reseting
# Missing file ? reseting
[[ ! -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 LE RESEAU... CONTINUE" && echo && cp ~/.zen/bunkerbox/history_qo-op.json ~/.zen/bunkerbox/history.json && continue
# JSON FUSION
@ -302,7 +309,7 @@ echo "##########################################################################
cat ~/.zen/bunkerbox/history.json | jq '.Videos += [{"link": "<a id='"'_TSVUID_'"' href='"'_INDEX_'"'><img src='"'_INDEX_/_VUID_.jpg'"' height=80 ></a><br>'"'_TITLE_'"'"}]' > ~/.zen/bunkerbox/cache/$VUID/media/history.json
# sed -i "s~_TSVUID_~$TS$VUID~g" ~/.zen/bunkerbox/cache/$VUID/media/history.json # Makes different chain for each creator !!
sed -i "s~_INDEX_~$INDEX~g" ~/.zen/bunkerbox/cache/$VUID/media/history.json
sed -i "s~_VUID_~$VUID~g" ~/.zen/bunkerbox/cache/$VUID/media/history.json
sed -i "s~_TSVUID_~$VUID~g" ~/.zen/bunkerbox/cache/$VUID/media/history.json
sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/cache/$VUID/media/history.json
# COULD BE DONE LIKE THAT