jq adding

This commit is contained in:
fred 2022-10-15 19:26:08 +02:00
parent abf7cb9cd9
commit d728bc7264
1 changed files with 3 additions and 2 deletions

View File

@ -7,12 +7,13 @@ 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 "Adding $channel"
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
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
cp ~/.zen/tmp/chan_cloud_plus.json ~/.zen/tmp/chan_cloud.json