#!/bin/bash MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized . "$MY_PATH/my.sh" #Set Path to Images img_dir="$1" if [[ ! -d $img_dir ]]; then echo "STATION CAROUSEL MODE" rm -Rf ~/.zen/tmp/carousel 2>/dev/null mkdir -p ~/.zen/tmp/carousel # Make it with latest PLAYERS WALLETS PLAYERONE=($(ls -t ~/.zen/game/players/ | grep -Ev "localhost" 2>/dev/null)) ## RUNING FOR ALL LOCAL PLAYERS for PLAYER in ${PLAYERONE[@]}; do pub=$(cat ~/.zen/game/players/$PLAYER/.g1pub) curl -so ~/.zen/tmp/carousel/${pub}.png \ "https://g1sms.fr/g1barre/image.php?pubkey=${pub}&target=20000&title=${PLAYER}&node=g1.duniter.org&start_date=2020-01-01&display_pubkey=true&display_qrcode=true" done img_dir="$HOME/.zen/tmp/carousel" fi #Set Path to HTML page html_file="/tmp/index.html" #Create HTML page echo " Astroport IPFS Gallery

Astroport ZEN Gallery $(date)

" >> $html_file #Loop over images num=1 for i in "$img_dir"/*; do if [[ $i =~ \.(JPG|jpg|PNG|png|JPEG|jpeg|GIF|gif)$ ]]; then ilink=$(ipfs add -q $i) img_info=$(identify -format '%w %h %[EXIF:*]' $i) img_width=$(echo $img_info | cut -d ' ' -f1) img_height=$(echo $img_info | cut -d ' ' -f2) img_alt=$(echo $img_info | cut -d ' ' -f3) if [ $num -eq 1 ]; then echo "
\"$img_alt\"
" >> $html_file else echo "
\"$img_alt\"
" >> $html_file fi num=$((num+1)) fi done echo "
" >> $html_file htmlipfs=$(ipfs add -q $html_file) [[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open ${myIPFSGW}/ipfs/$htmlipfs echo /ipfs/$htmlipfs exit 0