diff --git a/crowdbunker.sh b/crowdbunker.sh
index b26e92f..086fb02 100755
--- a/crowdbunker.sh
+++ b/crowdbunker.sh
@@ -65,8 +65,9 @@ curl -s $VWALLURL -H "Accept: application/json" > ~/.zen/bunkerbox/crowd.json
cat ~/.zen/bunkerbox/crowd.json | jq -r '.posts | .[] | .video.id' > /tmp/vuid.list
# loop starts with older videos (tac is reversing cat)
for VUID in $(tac /tmp/vuid.list); do
+ echo "====================== =========================== ==========================="
[[ "$VUID" == "null" ]] && echo "MESSAGE... Bypassing..." && echo && continue
- echo "====================================================="
+ echo "====================== =========================== ==========================="
echo "Bunker BOX : Adding $VUID"
mkdir -p ~/.zen/bunkerbox/cache/$VUID/media
@@ -157,7 +158,8 @@ echo "##########################################################################
# get latest history.json publishes with (shared?) 'qo-op' IPNS key
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
- IPNSL="/ipns/$(ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ')"
+ IPNS="$(ipfs key list -l | grep '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
[[ ! -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
@@ -166,6 +168,7 @@ echo "##########################################################################
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
else
+ IPNS="."
IPNSL="./"
fi
@@ -184,13 +187,13 @@ echo "##########################################################################
sed -i "s~_IPNSL_~$IPNSL~g" ~/.zen/bunkerbox/cache/$VUID/media/index.html #MAJ IPNS link
echo ">>>>> NOW ADDING MEDIA TO IPFS : ipfs add -rwH ~/.zen/bunkerbox/cache/$VUID/media/* "
- echo
-
################################################################# #########
# IPFS WRITING. All that is prepared above in ~/.zen/bunkerbox/cache/$VUID/media/ will become permanent !
################################################################# #########
IPFSROOT=$(ipfs add -rwHq ~/.zen/bunkerbox/cache/$VUID/media/* | tail -n 1)
INDEX="/ipfs/$IPFSROOT"
+ echo "DONE : $INDEX"
+ echo
#################################################################
# IPFS WRITING DONE. Doing after is to UPDATE local history(s).json in ~/.zen/bunkerbox/
# $INDEX/$VUID.m3u8 is ready + videojs.html + json's
@@ -202,7 +205,7 @@ echo "##########################################################################
[[ ! -f ~/.zen/bunkerbox/history.${CHANNEL}.json || $(cat ~/.zen/bunkerbox/history.${CHANNEL}.json 2>/dev/null) == "" ]] && cp ${MY_PATH}/templates/data/history.json ~/.zen/bunkerbox/history.${CHANNEL}.json
if [[ ! $(cat ~/.zen/bunkerbox/history.${CHANNEL}.json | jq .Videos[].link | grep $VUID) ]]; then ## This is a new video !!!
- echo "ADD ~/.zen/bunkerbox/history.${CHANNEL}.json"
+ echo "NEW VIDEO ADDED TO ~/.zen/bunkerbox/history.${CHANNEL}.json"
# cat ~/.zen/bunkerbox/history.${CHANNEL}.json | jq --arg INDEX "$INDEX" --arg TITLE "$TITLE" --arg VUID "$VUID" --arg TSVUID "TSVUID" '.Videos += [{"link": "
"'"$TITLE"'" "}]' > ~/.zen/tmp/history.${CHANNEL}.json
cat ~/.zen/bunkerbox/history.${CHANNEL}.json | jq '.Videos += [{"link": "
'"'_TITLE_'"'"}]' > ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json
sed -i "s~_INDEX_~$INDEX~g" ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json
@@ -215,7 +218,7 @@ echo "##########################################################################
######################### ######################### #########################
## Add to Video caroussel json
-
+ #########################
[[ ! -f ~/.zen/bunkerbox/caroussel.${CHANNEL}.json ]] && CARSRC="${MY_PATH}/templates/data/videowallcaroussel.json" || CARSRC="~/.zen/bunkerbox/caroussel.${CHANNEL}.json "
SOURCE="$INDEX/$VUID.m3u8"
POSTER="$INDEX/$VUID.jpg"
@@ -231,16 +234,18 @@ echo "##########################################################################
[[ "$(cat ~/.zen/bunkerbox/cache/$VUID/media/caroussel.json)" == "" ]] && echo "NO caroussel.${CHANNEL}.json FATAL ERROR" && exit 1
## MAJ Racine.
cp ~/.zen/bunkerbox/cache/$VUID/media/caroussel.json ~/.zen/bunkerbox/caroussel.${CHANNEL}.json
+ #########################
- ######################### ######################### ######################### TO FINISH
- ## CONSTRUCT 'MOA' CHANNEL PUBLICATION ZONE.
+ ######################### ######################### #########################
+ ## CONSTRUCT 'MOA' CHANNEL PUBLICATION ZONE ```rm -Rf ~/.zen/bunkerbox/channels/${CHANNEL} to reset```
if [[ ! -f ~/.zen/bunkerbox/channels/${CHANNEL}/qo-op_${CHANNEL}.key ]]; then
mkdir -p ~/.zen/bunkerbox/homepage/${CHANNEL}/
mkdir -p ~/.zen/bunkerbox/channels/${CHANNEL}/
# New tiddlywiki with moa key
if [[ ! $(ipfs key list | grep qo-op_${CHANNEL}) ]]; then
channelfilename=$(${MY_PATH}/tools/give_me_keystore_filename.py qo-op_${CHANNEL})
- # Creating IPNS Key for channel
+ # (Re)Creating IPNS Key & TiddlyWiki for channel
+ ipfs key rm qo-op_${CHANNEL}
channelkey=$(ipfs key gen qo-op_${CHANNEL})
# Create first tiddlywiki and inject some values
sed "s~_BIRTHDATE_~${MOATS}~g" ${MY_PATH}/templates/ipfstiddlywiki.html > ~/.zen/bunkerbox/homepage/${CHANNEL}/index.html
@@ -260,10 +265,12 @@ echo "##########################################################################
fi
fi
######################### ######################### #########################
+ else
+ echo "VIDEO ALREADY THERE"
fi
- #################
- ## UPDATE GLOCAL HISTORY ?
+ #############################
+ ## UPDATE GLOBAL LOCAL HISTORY
IsThere=$(cat ~/.zen/bunkerbox/history.json | jq .Videos[].link | grep $VUID)
if [[ ! $IsThere ]]; then
echo "Add $INDEX to ~/.zen/bunkerbox/cache/$VUID/media/history.json"
@@ -280,17 +287,16 @@ echo "##########################################################################
[[ "$(cat ~/.zen/bunkerbox/cache/$VUID/media/history.json)" == "" ]] && echo "NO $VUID/media/history.json FATAL ERROR" && exit 1
# Upgrade local history.json with new one
if [[ -f ~/.zen/bunkerbox/cache/$VUID/media/history.json ]]; then
- echo '{ "Videos":' > ~/.zen/bunkerbox/history.json
- cat ~/.zen/bunkerbox/cache/$VUID/media/history.json | jq '.[]' >> ~/.zen/bunkerbox/history.json
- echo '}' >> ~/.zen/bunkerbox/history.json
+ cp ~/.zen/bunkerbox/cache/$VUID/media/history.json ~/.zen/bunkerbox/history.json
fi
fi
+ #############################
#################
VMAIN="/ipfs/$IPFSROOT/$VUID.m3u8"
# UPDATING original JSON - TODO inform crowdbunker that IPFS copy is available.
cat ~/.zen/bunkerbox/cache/$VUID/media/$VUID.json | jq ".video.hlsManifest.url = \"$VMAIN\"" > ~/.zen/bunkerbox/cache/$VUID/$VUID.json
- echo "TODO: CALL BACK SOURCE ... New HLS = $IPFSNGW$VMAIN"
+ echo "New HLS = $IPFSNGW$VMAIN"
#################
# Create local index.html simple redirect to current IPFS video
@@ -358,9 +364,9 @@ echo "##########################################################################
ipfs key list -l | grep 'qo-op' | cut -f 1 -d ' ' > ~/.zen/bunkerbox/qo-op
fi
echo 'qo-op' > ~/.zen/bunkerbox/choice
- IPNS=$(cat ~/.zen/bunkerbox/qo-op)
+ IPNSL=$(cat ~/.zen/bunkerbox/qo-op)
echo
- echo "Chaine Vidéo 'qo-op' => $IPFSNGW/ipns/$IPNS"
+ echo "Chaine Vidéo 'qo-op' => $IPFSNGW/ipns/$IPNSL"
echo
##### NEW HOMEPAGE / NEW DYNAMIC DATA ###### HERE TIMESTAMPING IS OK
InHere=$(cat ~/.zen/bunkerbox/history_*.json | jq .Videos[].link | grep $VUID)
@@ -391,8 +397,8 @@ echo "##########################################################################
#
# BALISE=$(echo $TS | ipfs add -q)
# ipfs name publish $BALISE ##### $IPFSNODEID IS now confirming it recognizes this TS as last publishing !!
- # TIME=$(ipfs cat /ipns/$IPNS/ts)
- # WHO=$(ipfs cat /ipns/$IPNS/time/$TIME)
+ # TIME=$(ipfs cat /ipns/$IPNSL/ts)
+ # WHO=$(ipfs cat /ipns/$IPNSL/time/$TIME)
# ISTRUE=$(ipfs cat /ipns/$WHO)
# TIME == ISTRUE ? ####### Et voilà ;)
diff --git a/templates/videojs.html b/templates/videojs.html
index 6525766..0f1435e 100644
--- a/templates/videojs.html
+++ b/templates/videojs.html
@@ -18,7 +18,7 @@