From 0b43802a97755e1d280d647244dde298f171e33e Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 15 Oct 2022 20:47:47 +0200 Subject: [PATCH] [ $howmuch -gt 220 ] && BIGCHAN="${channel}($howmuch) $BIGCHAN" && continue --- crowdbunker.sh | 5 ++++- tools/get_tagcloud_data.sh | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crowdbunker.sh b/crowdbunker.sh index 6dae1e1..7d4ae4d 100755 --- a/crowdbunker.sh +++ b/crowdbunker.sh @@ -417,7 +417,10 @@ echo "########################################################################## sed -i "s~_VUID_~$INDEX/$VUID~g" ~/.zen/bunkerbox/homepage/index.html sed -i "s/_WHO_/$(date -u "+%Y-%m-%d#%H:%M:%S")@$IPFSNODEID/g " ~/.zen/bunkerbox/homepage/index.html sed -i "s~_TITLE_~$TITLE~g" ~/.zen/bunkerbox/homepage/index.html - TAGS=$(${MY_PATH}/tools/get_tagcloud_data.sh $IPNS) + + ${MY_PATH}/tools/get_tagcloud_data.sh $IPNS + TAGS=$(cat ~/.zen/tmp/chan_cloud.json | jq -c .[]) + sed -i "s~_TAGCLOUD_~$TAGS~g" ~/.zen/bunkerbox/homepage/index.html # Copy json's diff --git a/tools/get_tagcloud_data.sh b/tools/get_tagcloud_data.sh index 7e69f8f..49525f0 100755 --- a/tools/get_tagcloud_data.sh +++ b/tools/get_tagcloud_data.sh @@ -7,9 +7,11 @@ IPNS="$1" echo '{"data":[]}' > ~/.zen/tmp/chan_cloud.json for channel in $(ls ~/.zen/bunkerbox/channels); do - howmuch=$(jq '.Videos | length' ~/.zen/bunkerbox/history.${channel}.json) + [[ -s ~/.zen/bunkerbox/history.${channel}.json ]] && howmuch=$(jq '.Videos | length' ~/.zen/bunkerbox/history.${channel}.json) [[ ! $howmuch ]] && continue + echo "Adding $channel ($howmuch videos)" + [ $howmuch -gt 220 ] && BIGCHAN="${channel}($howmuch) $BIGCHAN" && continue cat ~/.zen/tmp/chan_cloud.json | jq '.data += [{"name": "'''$channel'''", "link": "/ipns/'''$IPNS'''/tw/'''$channel'''", "weight": "'''$howmuch'''" ,"tooltip": "'''$channel'''"}]' > ~/.zen/tmp/chan_cloud_plus.json @@ -17,4 +19,5 @@ for channel in $(ls ~/.zen/bunkerbox/channels); do done -cat ~/.zen/tmp/chan_cloud.json | jq -c .[] + +## "data:" dans le template homepage.html