From 4584a62c036c3de251a236d6dfc5fa00411aa85a Mon Sep 17 00:00:00 2001 From: fred Date: Thu, 21 Apr 2022 22:47:18 +0200 Subject: [PATCH] /tw/caroussel.html get_astrXbian_youtube --- crowdbunker.sh | 24 +++--------------------- templates/caroussel.html | 2 +- tools/get_astrXbian_youtube.sh | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 22 deletions(-) create mode 100755 tools/get_astrXbian_youtube.sh diff --git a/crowdbunker.sh b/crowdbunker.sh index 5b0111b..b08d0d7 100755 --- a/crowdbunker.sh +++ b/crowdbunker.sh @@ -219,26 +219,6 @@ echo "########################################################################## # REFRESH ${CHANNEL}'s HISTORY ~/.zen/bunkerbox/ cp ~/.zen/bunkerbox/cache/$VUID/media/history.${CHANNEL}.json ~/.zen/bunkerbox/history.${CHANNEL}.json - ######################### ######################### ######################### - ## 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" - cat $CARSRC | jq --arg SOURCE "$SOURCE" --arg POSTER "$POSTER" --arg TITLE "$TITLE" '.videos[.videos| length] -|= . + -{ - "src": "'"$SOURCE"'", - "poster": "'"$POSTER"'", - "mime": "application/x-mpegURL", - "title": "'"$TITLE"'" -}' > ~/.zen/bunkerbox/cache/$VUID/media/caroussel.json - # SECURE - [[ "$(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 - ######################### - ######################### ######################### ######################### ## CONSTRUCT 'MOA' CHANNEL PUBLICATION ZONE ```rm -Rf ~/.zen/bunkerbox/channels/${CHANNEL} to reset``` if [[ ! -f ~/.zen/bunkerbox/homepage/tw/${CHANNEL}/index.html ]]; then @@ -261,11 +241,13 @@ echo "########################################################################## sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/bunkerbox/channels/${CHANNEL}/index.html - # Create caroussel.html !!! NOT WORKING WITH M3U8 !!!! + # 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}/ ## BACKUP IPNS KEY qo-op_${CHANNEL}.key WILL BE SENT BY OTHER MEAN diff --git a/templates/caroussel.html b/templates/caroussel.html index 6cd119e..be37eae 100644 --- a/templates/caroussel.html +++ b/templates/caroussel.html @@ -65,7 +65,7 @@ diff --git a/tools/get_astrXbian_youtube.sh b/tools/get_astrXbian_youtube.sh new file mode 100755 index 0000000..e07beab --- /dev/null +++ b/tools/get_astrXbian_youtube.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# echo create data set from astrXbian youtube copies to include into caroussel +IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) + +[[ ! $IPFSNODEID ]] && echo "Please Install IPFS & astrXbian for this to work" && exit 1 + +for line in $(cat ~/.zen/ipfs/.$IPFSNODEID/YASTRXBIAN); do + + source=$(echo $line | rev | cut -d ';' -f 1 | rev) + title=$(echo $line | cut -d ';' -f 4 ) + + DATA="$DATA { src : '"${source}"', poster: '"/ipns/crowdbunker.com/styles/logo.png"', mime : 'video/mp4', title : '"${title}"' }," + +done + +echo 'videos : [ '$DATA' ]'