bunkerbox/tools/get_tagcloud_data.sh

22 lines
845 B
Bash
Executable File

#!/bin/bash
[[ ! $1 ]] && echo "You must provide 'qo-op' IPNS key"&& exit 1
# echo create data set to include into tagcloud
# HERE YOU CAN MODIFY HOMEPAGE TAGCLOUD PROPERTIES
IPNS="$1"
echo "{data:[]}" > ~/.zen/tmp/chan_cloud.json
for channel in $(ls ~/.zen/bunkerbox/channels); do
echo "Adding $channel"
howmuch=$(jq '.Videos | length' ~/.zen/bunkerbox/history.${channel}.json)
[[ ! $howmuch ]] && continue
echo "$howmuch posting"
cat ~/.zen/tmp/chan_cloud.json | jq --arg CHANNEL "$channel" --arg HOWMUCH "$howmuch" --arg IPNS "$IPNS" '.data += [{"name": "'''$CHANNEL'''", "link": "/ipns/'''$IPNS'''/tw/'''$CHANNEL'''", "weight": "'''$HOWMUCH'''" ,"tooltip": "'''$CHANNEL'''"}]' > ~/.zen/tmp/chan_cloud_plus.json
cp ~/.zen/tmp/chan_cloud_plus.json ~/.zen/tmp/chan_cloud.json
done
cat ~/.zen/tmp/chan_cloud.json