bunkerbox/tools/get_astrXbian_youtube.sh

38 lines
1.2 KiB
Bash
Executable File

#!/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
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