From 9dca3e91baeb0322545b82788d8c678b659b9dde Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Apr 2022 13:59:16 +0200 Subject: [PATCH] mp4 caroussel from 'Journal' --- crowdbunker.sh | 46 ++++++++++++++++++++-------------- templates/caroussel.html | 2 +- tools/get_astrXbian_youtube.sh | 25 ++++++++++++++++-- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/crowdbunker.sh b/crowdbunker.sh index 8fd3810..bbbc217 100755 --- a/crowdbunker.sh +++ b/crowdbunker.sh @@ -213,6 +213,7 @@ echo "########################################################################## 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 sed -i "s~_VUID_~$VUID~g" ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json + sed -i "s~_TS_~$MOATS~g" ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json # SECURE [[ "$(cat ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json)" == "" ]] && echo "NO history.${CHANNEL}.json FATAL ERROR" && exit 1 @@ -223,35 +224,42 @@ echo "########################################################################## ######################### ######################### ######################### ## CONSTRUCT 'MOA' CHANNEL PUBLICATION ZONE ```rm -Rf ~/.zen/bunkerbox/channels/${CHANNEL} to reset``` AmIBootStrap=$(cat ~/.zen/astrXbian/A_boostrap_nodes.txt 2>/dev/null | grep $IPFSNODEID) - if [[ ! -f ~/.zen/bunkerbox/homepage/tw/${CHANNEL}/index.html && $AmIBootStrap ]]; then + if [[ ! -f ~/.zen/bunkerbox/homepage/tw/${CHANNEL}/twindex.html ]]; then mkdir -p ~/.zen/bunkerbox/homepage/tw/${CHANNEL}/ mkdir -p ~/.zen/bunkerbox/channels/${CHANNEL}/ # New tiddlywiki with moa key # if [[ ! $(ipfs key list | grep -w qo-op_${CHANNEL}) ]]; then channelfilename=$(${MY_PATH}/tools/give_me_keystore_filename.py qo-op_${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/channels/${CHANNEL}/index.html - sed -i "s~_PSEUDO_~${CHANNEL}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html - sed -i "s~_MOAID_~${channelkey}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html - sed -i "s~_QOOP_~${IPNSL}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html - sed -i "s~_MOAKEY_~qo-op_${CHANNEL}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html - sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${channelkey}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html - sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html ## Open 5001 - sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + [[ $AmIBootStrap ]] &&\ + ipfs key rm qo-op_${CHANNEL}; channelkey=$(ipfs key gen qo-op_${CHANNEL}) || \ + channelkey='k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2' + + # Create first tiddlywiki and inject some values (_PLAYER_ from Astroport.ONE) + sed "s~_BIRTHDATE_~${MOATS}~g" ${MY_PATH}/templates/ipfstiddlywiki.html > ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html + sed -i "s~_PSEUDO_~${CHANNEL}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html + sed -i "s~_MOAID_~${channelkey}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html + sed -i "s~_QOOP_~${IPNSL}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html + sed -i "s~_MOAKEY_~qo-op_${CHANNEL}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html + sed -i "s~k2k4r8opmmyeuee0xufn6txkxlf3qva4le2jlbw6da7zynhw46egxwp2~${channelkey}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html + sed -i "s~ipfs.infura.io~tube.copylaradio.com~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html ## Open 5001 + sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/twindex.html # Create caroussel.html !!! NOT WORKING WITH M3U8 !!!! SO DOING IT WITH astrXbian ;) - sed "s~_IPNSL_~$IPNSL~g" ${MY_PATH}/templates/caroussel.html > ~/.zen/bunkerbox/channels/${CHANNEL}/caroussel.html - sed -i "s~_VUID_~$INDEX/$VUID~g" ~/.zen/bunkerbox/channels/${CHANNEL}/caroussel.html - sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/channels/${CHANNEL}/caroussel.html - sed -i "s~_CHANNEL_~$CHANNEL~g" ~/.zen/bunkerbox/channels/${CHANNEL}/caroussel.html XBIANJSON=$(${MY_PATH}/tools/get_astrXbian_youtube.sh) ## Replace old way with external caroussel.json - sed -i "s~_CAROUSSELJSON_~$XBIANJSON~g" ~/.zen/bunkerbox/channels/${CHANNEL}/caroussel.html - cp -R ${MY_PATH}/templates/styles ~/.zen/bunkerbox/channels/${CHANNEL}/ - cp -R ${MY_PATH}/templates/js ~/.zen/bunkerbox/channels/${CHANNEL}/ + if [[ $XBIANJSON == '' ]]; then + echo "" > ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + else + sed "s~_IPNSL_~$IPNSL~g" ${MY_PATH}/templates/caroussel.html > ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + sed -i "s~_VUID_~$INDEX/$VUID~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + sed -i "s~_CHANNEL_~$CHANNEL~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + sed -i "s~_CAROUSSELJSON_~$XBIANJSON~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html + + cp -R ${MY_PATH}/templates/styles ~/.zen/bunkerbox/channels/${CHANNEL}/ + cp -R ${MY_PATH}/templates/js ~/.zen/bunkerbox/channels/${CHANNEL}/ + fi ## BACKUP IPNS KEY qo-op_${CHANNEL}.key WILL BE SENT BY OTHER MEAN # cp ~/.ipfs/keystore/${channelfilename} ~/.zen/bunkerbox/channels/${CHANNEL}/qo-op_${CHANNEL}.key diff --git a/templates/caroussel.html b/templates/caroussel.html index a2b05eb..9ac629f 100644 --- a/templates/caroussel.html +++ b/templates/caroussel.html @@ -38,7 +38,7 @@ width="auto" height="360" poster="_VUID_.jpg" > - +

Activer JavaScript SVP

diff --git a/tools/get_astrXbian_youtube.sh b/tools/get_astrXbian_youtube.sh index e07beab..0f2c21e 100755 --- a/tools/get_astrXbian_youtube.sh +++ b/tools/get_astrXbian_youtube.sh @@ -1,6 +1,29 @@ #!/bin/bash # echo create data set from astrXbian youtube copies to include into caroussel IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) +[[ -d ~/Bureau ]] && DESK="Bureau" +[[ -d ~/Desktop ]] && DESK="Desktop" + +DATA="" + +for tiddler in $(ls ~/$DESK/Journal/youtube/*.json); do + + title=$(cat $tiddler | jq -r .[0].title) + text=$(cat $tiddler | jq -r .[0].text) + mime=$(cat $tiddler | jq -r .[0].mime) + poster=$(cat $tiddler | jq -r .[0].poster) + ipfsroot=$(cat $tiddler | jq -r .[0].ipfsroot) + file=$(cat $tiddler | jq -r .[0].file) + + [[ $poster == '' ]] && poster='/ipns/crowdbunker.com/styles/logo.png' + source='/ipfs/'$ipfsroot/$file + DATA="$DATA { src : '"${source}"', poster: '"${poster}"', mime : '"${mime}"', title : '"${title}"' }," +done + + +[[ $DATA != '' ]] && echo 'videos : [ '$DATA' ]' + +exit 0 [[ ! $IPFSNODEID ]] && echo "Please Install IPFS & astrXbian for this to work" && exit 1 @@ -12,5 +35,3 @@ for line in $(cat ~/.zen/ipfs/.$IPFSNODEID/YASTRXBIAN); do DATA="$DATA { src : '"${source}"', poster: '"/ipns/crowdbunker.com/styles/logo.png"', mime : 'video/mp4', title : '"${title}"' }," done - -echo 'videos : [ '$DATA' ]'