From 6272e89a241251b62e7c8d811240e34584afd3e0 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 25 Apr 2023 18:11:40 +0200 Subject: [PATCH] replace "ASTONAUTENS" whith "ASTRONAUTENS" --- ASTROBOT/G1CopierYoutube.sh | 110 ++++++++++++++++----------------- tools/VOEUX.print.sh | 60 +++++++++--------- tools/new_file_in_astroport.sh | 2 +- 3 files changed, 87 insertions(+), 85 deletions(-) diff --git a/ASTROBOT/G1CopierYoutube.sh b/ASTROBOT/G1CopierYoutube.sh index c57b9084..be34f6a4 100755 --- a/ASTROBOT/G1CopierYoutube.sh +++ b/ASTROBOT/G1CopierYoutube.sh @@ -21,12 +21,12 @@ INDEX="$1" [[ ! -s ${INDEX} ]] && echo "ERROR - Fichier TW absent. ${INDEX}" && exit 1 PLAYER="$2" -[[ ! $PLAYER ]] && echo "ERROR - Please provide IPFS publish key" && exit 1 +[[ ! ${PLAYER} ]] && echo "ERROR - Please provide IPFS publish key" && exit 1 -ASTONAUTENS=$(ipfs key list -l | grep -w $PLAYER | cut -d ' ' -f1) -[[ ! $ASTONAUTENS ]] && echo "ERROR - Clef IPNS $PLAYER introuvable!" && exit 1 +ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1) +[[ ! $ASTRONAUTENS ]] && echo "ERROR - Clef IPNS ${PLAYER} introuvable!" && exit 1 -G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub) +G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub) # Extract tag=tube from TW MOATS="$3" @@ -35,34 +35,34 @@ MOATS="$3" ################################################################### ## CREATE APP NODE PLAYER PUBLICATION DIRECTORY ################################################################### -mkdir -p $HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/ -mkdir -p $HOME/.zen/game/players/$PLAYER/G1CopierYoutube/ +mkdir -p ${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER}/ +mkdir -p ${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/ ################################################################### ## tag[CopierYoutube] EXTRACT ~/.zen/tmp/CopierYoutube.json FROM TW ################################################################### -rm -f ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json +rm -f ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json tiddlywiki --load ${INDEX} \ - --output ~/.zen/game/players/$PLAYER/G1CopierYoutube \ + --output ~/.zen/game/players/${PLAYER}/G1CopierYoutube \ --render '.' 'CopierYoutube.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[CopierYoutube]]' -echo "DEBUG : cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json | jq -r" +echo "DEBUG : cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json | jq -r" BZER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser [[ $BZER ]] && BROWSER="--cookies-from-browser $BZER " || BROWSER="" [[ ! $isLAN ]] && BROWSER="" ################################################################### -## URL EXTRACTION & yt-dlp.cache.$PLAYER upgrade -for YURL in $(cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json | jq -r '.[].text' | grep 'http'); do +## URL EXTRACTION & yt-dlp.cache.${PLAYER} upgrade +for YURL in $(cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.json | jq -r '.[].text' | grep 'http'); do [[ ! $(echo $YURL | grep "http" ) ]] && echo "$YURL error" && continue echo "G1CopierYoutube : $YURL" - echo "Extracting video playlist into yt-dlp.cache.$PLAYER" + echo "Extracting video playlist into yt-dlp.cache.${PLAYER}" ### yt-dlp.command - CMD=$(cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command 2>/dev/null | grep "$YURL" | tail -n 1) + CMD=$(cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.command 2>/dev/null | grep "$YURL" | tail -n 1) if [[ ! $CMD ]]; then - echo "$PLAYER&$YURL:$MOATS" >> ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command - echo "NOUVEAU CANAL $PLAYER&$YURL:$MOATS" + echo "${PLAYER}&$YURL:$MOATS" >> ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.command + echo "NOUVEAU CANAL ${PLAYER}&$YURL:$MOATS" lastrun=$MOATS duree=604800000 else @@ -70,18 +70,18 @@ for YURL in $(cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json duree=$(expr ${MOATS} - $lastrun) fi # ONE WEEK NEW SCAN - if [[ $duree -ge 604800000 || ! -s ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER ]]; then - /usr/local/bin/yt-dlp $BROWSER --print "%(id)s&%(webpage_url)s" "${YURL}" >> ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER - sed -i "s~$lastrun~$MOATS~g" ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command # UPDATE LASTRUN + if [[ $duree -ge 604800000 || ! -s ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.cache.${PLAYER} ]]; then + /usr/local/bin/yt-dlp $BROWSER --print "%(id)s&%(webpage_url)s" "${YURL}" >> ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.cache.${PLAYER} + sed -i "s~$lastrun~$MOATS~g" ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.command # UPDATE LASTRUN fi done # FINISH YURL loop -## CREATE SORT UNIQ SHUFFLED ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER (12345 ONLINE) -cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER 2>/dev/null | sort | uniq | shuf > ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER +## CREATE SORT UNIQ SHUFFLED ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} (12345 ONLINE) +cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/yt-dlp.cache.${PLAYER} 2>/dev/null | sort | uniq | shuf > ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} ################################################################### -[[ ! -s ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER ]] && echo "AUCUN YOUTUBEID pour CopierYoutube" && exit 0 +[[ ! -s ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} ]] && echo "AUCUN YOUTUBEID pour CopierYoutube" && exit 0 ################################################################### boucle=0 tot=0 @@ -96,9 +96,9 @@ while read LINE; ################################################################### ## Search for $YID.TW.json TIDDLER in local & MySwarm cache - echo "--- CACHE SEARCH FOR $YID ---" && TIDDLER=$(ls -t "$HOME/.zen/game/players/"*"/G1CopierYoutube/$YID.TW.json" 2>/dev/null | head -n 1) - [[ ! $TIDDLER ]] && TIDDLER=$(ls -t "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1) - [[ ! $TIDDLER ]] && TIDDLER=$(ls -t "$HOME/.zen/tmp/swarm/"*"/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1) + echo "--- CACHE SEARCH FOR $YID ---" && TIDDLER=$(ls -t "${HOME}/.zen/game/players/"*"/G1CopierYoutube/$YID.TW.json" 2>/dev/null | head -n 1) + [[ ! $TIDDLER ]] && TIDDLER=$(ls -t "${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1) + [[ ! $TIDDLER ]] && TIDDLER=$(ls -t "${HOME}/.zen/tmp/swarm/"*"/G1CopierYoutube/"*"/$YID.TW.json" 2>/dev/null | head -n 1) [[ $TIDDLER ]] && echo "Tiddler Found in CACHE : $TIDDLER" \ || echo "EMPTY." ################################################################### @@ -123,7 +123,7 @@ if [[ ! ${TIDDLER} ]]; then # SUBS ? --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs # (bv*[height<=720][vcodec~='^((he|a)vc|h26[45])']+ba) # TODO : DELAY COPY OPERATION... Astro can download quicker at 03:00 AM - echo "/usr/local/bin/yt-dlp -f \"(bv*[ext=mp4][height<=720]+ba/b[height<=720])\" --no-mtime --embed-thumbnail --add-metadata -o \"$HOME/.zen/tmp/yt-dlp/$TITLE.%(ext)s\" ${ZYURL}" + echo "/usr/local/bin/yt-dlp -f \"(bv*[ext=mp4][height<=720]+ba/b[height<=720])\" --no-mtime --embed-thumbnail --add-metadata -o \"${HOME}/.zen/tmp/yt-dlp/$TITLE.%(ext)s\" ${ZYURL}" ############################################################################# ## COPY FROM YOUTUBE (TODO DOUBLE COPY & MKV to MP4 OPTIMISATION) @@ -132,9 +132,9 @@ if [[ ! ${TIDDLER} ]]; then /usr/local/bin/yt-dlp -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \ $BROWSER \ - --download-archive $HOME/.zen/.yt-dlp.list \ + --download-archive ${HOME}/.zen/.yt-dlp.list \ -S res,ext:mp4:m4a --recode mp4 --no-mtime --embed-thumbnail --add-metadata \ - -o "$HOME/.zen/tmp/yt-dlp/$TITLE.%(ext)s" ${ZYURL} + -o "${HOME}/.zen/tmp/yt-dlp/$TITLE.%(ext)s" ${ZYURL} ################################################################################ ### ADAPT TO TW RYTHM (DELAY COPY?) @@ -143,30 +143,30 @@ if [[ ! ${TIDDLER} ]]; then ############################################################################ ### CHECK RESULT CONVERT MKV TO MP4 - [[ -s "$HOME/.zen/tmp/yt-dlp/$TITLE.mkv" ]] && ffmpeg -loglevel quiet -i "$HOME/.zen/tmp/yt-dlp/$TITLE.mkv" -c:v libx264 -c:a aac "$HOME/.zen/tmp/yt-dlp/$TITLE.mp4" # TRY TO CONVERT MKV TO MP4 + [[ -s "${HOME}/.zen/tmp/yt-dlp/$TITLE.mkv" ]] && ffmpeg -loglevel quiet -i "${HOME}/.zen/tmp/yt-dlp/$TITLE.mkv" -c:v libx264 -c:a aac "${HOME}/.zen/tmp/yt-dlp/$TITLE.mp4" # TRY TO CONVERT MKV TO MP4 - if [[ ! -s "$HOME/.zen/tmp/yt-dlp/$ZFILE" ]]; then + if [[ ! -s "${HOME}/.zen/tmp/yt-dlp/${ZFILE}" ]]; then echo "No FILE -- TRYING TO RESTORE CACHE FROM TW --" tiddlywiki --load ${INDEX} \ - --output ~/.zen/game/players/$PLAYER/G1CopierYoutube \ - --render '.' "'$YID.TW.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "$ZFILE" \ - && rm "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$ZFILE.json" && ln -s "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$ZFILE.json" + --output ~/.zen/game/players/${PLAYER}/G1CopierYoutube \ + --render '.' "'$YID.TW.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${ZFILE}" \ + && rm "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/${ZFILE}.json" && ln -s "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/$YID.TW.json" "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/${ZFILE}.json" continue fi echo #################################################### - echo "FOUND : ~/.zen/tmp/yt-dlp/$ZFILE" - FILE_BSIZE=$(du -b "$HOME/.zen/tmp/yt-dlp/$ZFILE" | awk '{print $1}') + echo "FOUND : ~/.zen/tmp/yt-dlp/${ZFILE}" + FILE_BSIZE=$(du -b "${HOME}/.zen/tmp/yt-dlp/${ZFILE}" | awk '{print $1}') [[ ! $FILE_BSIZE ]] && echo "SIZE ERROR" && continue FILE_SIZE=$(echo "${FILE_BSIZE}" | awk '{ split( "B KB MB GB TB PB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } printf "%.2f %s", $1, v[s] }') - echo "$boucle - $ZFILE - FILE SIZE = $FILE_SIZE ($FILE_BSIZE octets)" + echo "$boucle - ${ZFILE} - FILE SIZE = $FILE_SIZE ($FILE_BSIZE octets)" espeak "GOOD! Video Number $boucle = $FILE_SIZE" > /dev/null 2>&1 ### CREATE GIF ANIM : make_video_gifanim_ipfs.sh - $(${MY_PATH}/../tools/make_video_gifanim_ipfs.sh "$HOME/.zen/tmp/yt-dlp" "$ZFILE" | tail -n 1) ## export ANIMH + $(${MY_PATH}/../tools/make_video_gifanim_ipfs.sh "${HOME}/.zen/tmp/yt-dlp" "${ZFILE}" | tail -n 1) ## export ANIMH echo "HOP=$HOP ANIMH=$ANIMH PROBETIME=$PROBETIME @@ -179,12 +179,12 @@ if [[ ! ${TIDDLER} ]]; then ## Create gifanime ## TODO Search for similarities BEFORE ADD echo "Adding to IPFS" - ILINK=$(ipfs add -q "$HOME/.zen/tmp/yt-dlp/$ZFILE" | tail -n 1) - echo "/ipfs/$ILINK === $ZFILE" + ILINK=$(ipfs add -q "${HOME}/.zen/tmp/yt-dlp/${ZFILE}" | tail -n 1) + echo "/ipfs/$ILINK === ${ZFILE}" [[ $ILINK == "" ]] && echo ">>>>> BIG PROBLEM PAPA. NO IPFS " && continue - MIME=$(file --mime-type -b "$HOME/.zen/tmp/yt-dlp/$ZFILE") + MIME=$(file --mime-type -b "${HOME}/.zen/tmp/yt-dlp/${ZFILE}") ## ADD TAGS SEC=$(/usr/local/bin/yt-dlp $BROWSER --print "%(duration)s" "${ZYURL}") @@ -218,7 +218,7 @@ if [[ ! ${TIDDLER} ]]; then "giftime": "'${PROBETIME}'", "gifanime": "'/ipfs/${ANIMH}'", "modified": "'${MOATS}'", - "title": "'$ZFILE'", + "title": "'${ZFILE}'", "type": "'text/vnd.tiddlywiki'", "vtratio": "'${VTRATIO}'", "text": "'$TEXT'", @@ -231,14 +231,14 @@ if [[ ! ${TIDDLER} ]]; then "ipfs": "'/ipfs/${ILINK}'", "youtubeid": "'${YID}'", "zurl": "'${ZYURL}'", - "tags": "'ipfs G1CopierYoutube ${PLAYER} ${EXTRATAG} ${MIME} $(echo $ZFILE | sed 's~_~ ~g' | sed 's~\.~ ~g')'" + "tags": "'ipfs G1CopierYoutube ${PLAYER} ${EXTRATAG} ${MIME} $(echo ${ZFILE} | sed 's~_~ ~g' | sed 's~\.~ ~g')'" } ] -' > "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" +' > "${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER}/$YID.TW.json" tot=$((tot+1)) - TIDDLER="$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" + TIDDLER="${HOME}/.zen/tmp/${IPFSNODEID}/G1CopierYoutube/${PLAYER}/$YID.TW.json" else ################################################################### @@ -248,38 +248,38 @@ else continue fi -cp -f "${TIDDLER}" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/" +cp -f "${TIDDLER}" "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/" ################################################################# -### ADDING $YID.TW.json to ASTONAUTENS INDEX.html +### ADDING $YID.TW.json to ASTRONAUTENS INDEX.html ################################################################# echo "==========================" - echo "Adding $YID tiddler to TW /ipns/$ASTONAUTENS " + echo "Adding $YID tiddler to TW /ipns/$ASTRONAUTENS " - rm -f ~/.zen/tmp/$IPFSNODEID/newindex.html + rm -f ~/.zen/tmp/${IPFSNODEID}/newindex.html - echo ">>> Importing $HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" + echo ">>> Importing ${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/$YID.TW.json" tiddlywiki --load ${INDEX} \ - --import "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "application/json" \ - --output ~/.zen/tmp/$IPFSNODEID --render "$:/core/save/all" "newindex.html" "text/plain" + --import "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/$YID.TW.json" "application/json" \ + --output ~/.zen/tmp/${IPFSNODEID} --render "$:/core/save/all" "newindex.html" "text/plain" # --deletetiddlers '[tag[CopierYoutube]]' ### REFRESH CHANNEL COPY - if [[ -s ~/.zen/tmp/$IPFSNODEID/newindex.html ]]; then + if [[ -s ~/.zen/tmp/${IPFSNODEID}/newindex.html ]]; then ## COPY JSON TIDDLER TO PLAYER - ln -s "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$YID.TW.json" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/$ZFILE.json" + ln -s "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/$YID.TW.json" "${HOME}/.zen/game/players/${PLAYER}/G1CopierYoutube/${ZFILE}.json" - [[ $(diff ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} ) ]] && cp ~/.zen/tmp/$IPFSNODEID/newindex.html ${INDEX} && echo "===> Mise à jour ${INDEX}" + [[ $(diff ~/.zen/tmp/${IPFSNODEID}/newindex.html ${INDEX} ) ]] && cp ~/.zen/tmp/${IPFSNODEID}/newindex.html ${INDEX} && echo "===> Mise à jour ${INDEX}" else - echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/$IPFSNODEID/newindex.html" + echo "Problem with tiddlywiki command. Missing ~/.zen/tmp/${IPFSNODEID}/newindex.html" echo "XXXXXXXXXXXXXXXXXXXXXXX" fi -done < ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER # FINISH YID loop 1 +done < ~/.zen/tmp/${IPFSNODEID}/yt-dlp.cache.${PLAYER} # FINISH YID loop 1 exit 0 diff --git a/tools/VOEUX.print.sh b/tools/VOEUX.print.sh index 902ae773..11f762b2 100755 --- a/tools/VOEUX.print.sh +++ b/tools/VOEUX.print.sh @@ -9,10 +9,10 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized PLAYER=$1 -[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) -[[ $PLAYER == "" ]] && echo "PLAYER manquant" && exit 1 -PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null) -[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null) +[[ ${PLAYER} == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) +[[ ${PLAYER} == "" ]] && echo "PLAYER manquant" && exit 1 +PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) +[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null) [[ $G1PUB == "" ]] && echo "G1PUB manquant" && exit 1 ASTRONAUTENS=$(ipfs key list -l | grep -w "${G1PUB}" | cut -d ' ' -f 1) [[ $ASTRONAUTENS == "" ]] && echo "ASTRONAUTE manquant" && exit 1 @@ -20,9 +20,9 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "${G1PUB}" | cut -d ' ' -f 1) echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" ############################### ## EXTRACT G1Voeu from PLAYER TW -echo "Exporting $PLAYER TW [tag[G1Voeu]]" +echo "Exporting ${PLAYER} TW [tag[G1Voeu]]" rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json -tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html --output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]]' +tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html --output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]]' [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json ]] && echo "AUCUN G1VOEU - EXIT -" && exit 1 @@ -31,56 +31,58 @@ echo "VOEUX : ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt " echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - -for v in $(cat ~/.zen/game/players/$PLAYER/voeux/*/*/.title); do - g1pub=$(grep -r $v ~/.zen/game/players/$PLAYER/voeux/ 2>/dev/null | rev | cut -d '/' -f 2 | rev ) - echo "$v : $g1pub" - echo '------------------------------------------------------------------' +vlist="" +for v in $(cat ~/.zen/game/players/${PLAYER}/voeux/*/*/.title); do + g1pub=$(grep -r $v ~/.zen/game/players/${PLAYER}/voeux/ 2>/dev/null | head -n 1 | rev | cut -d '/' -f 2 | rev ) + #~ echo "$v : $g1pub" + #~ echo '------------------------------------------------------------------' vlist=($v:$g1pub ${vlist[@]}) done -echo "${vlist[@]}" +#~ echo "${vlist[@]}" PS3='Choisissez le voeux ___ ' -select voeu in "${vlist[@]}"; do - case $voeu in +select zwish in "${vlist[@]}"; do + case ${zwish} in "QUITTER") exit 0 ;; - *) echo "IMPRESSION $voeu" - voeu=$(echo $voeu | cut -d ':' -f2) ## Get G1PUB part - TITLE=$(echo $voeu | cut -d ':' -f1) ## Get Voeu title + *) echo "IMPRESSION ${voeu}" + TITLE=$(echo ${zwish} | cut -d ':' -f1) ## Get Voeu title + voeu=$(echo ${zwish} | cut -d ':' -f2) ## Get G1PUB part - VOEUXNS=$(ipfs key list -l | grep -w $voeu | cut -d ' ' -f1) + VOEUXNS=$(ipfs key list -l | grep -w ${voeu} | cut -d ' ' -f1) - choices=("TW" "G1") - PS3='Imprimer le QR du TiddlyWiki TW ou celui de son G1 portefeuille ?' + choices=("TW" "Ğ1") + PS3='Imprimer le QR (TW DApp) ou de son portefeuille (Ğ1) ?' select typ in "${choices[@]}"; do case $typ in "TW") echo "Changer de Gateway $myIPFS ?" read GW && [[ ! $GW ]] && GW="$myIPFS" - qrencode -s 12 -o "$HOME/.zen/game/world/$TITLE/$voeu/QR.WISHLINK.png" "$GW/ipns/$VOEUXNS" - convert $HOME/.zen/game/world/$TITLE/$voeu/QR.WISHLINK.png -resize 600 ~/.zen/tmp/START.png - echo " QR code $TITLE : $GW/ipns/$VOEUXNS" + qrencode -s 12 -o "$HOME/.zen/game/world/${TITLE}/${voeu}/QR.WISHLINK.png" "$GW/ipns/$VOEUXNS" + convert $HOME/.zen/game/world/${TITLE}/${voeu}/QR.WISHLINK.png -resize 600 ~/.zen/tmp/START.png + echo " QR code ${TITLE} : $GW/ipns/$VOEUXNS" break ;; - "G1") - qrencode -s 12 -o "$HOME/.zen/game/world/$TITLE/$voeu/G1PUB.png" "$voeu" - convert $HOME/.zen/game/world/$TITLE/$voeu/G1PUB.png -resize 600 ~/.zen/tmp/START.png + "Ğ1") + qrencode -s 12 -o "$HOME/.zen/game/world/${TITLE}/${voeu}/G1PUB.png" "${voeu}" + convert $HOME/.zen/game/world/${TITLE}/${voeu}/G1PUB.png -resize 600 ~/.zen/tmp/START.png break ;; esac done - convert -gravity northwest -pointsize 40 -fill black -draw "text 50,2 \"$TITLE ($typ)\"" ~/.zen/tmp/START.png ~/.zen/tmp/g1voeu1.png - convert -gravity southeast -pointsize 40 -fill black -draw "text 50,2 \"($typ) $TITLE\"" ~/.zen/tmp/g1voeu1.png ~/.zen/tmp/g1voeu.png + convert -gravity northwest -pointsize 40 -fill black -draw "text 50,2 \"${TITLE} ($typ)\"" ~/.zen/tmp/START.png ~/.zen/tmp/g1voeu1.png + convert -gravity southeast -pointsize 30 -fill black -draw "text 50,2 \"${GW}\"" ~/.zen/tmp/g1voeu1.png ~/.zen/tmp/g1voeu.png + #~ echo "~/.zen/tmp/g1voeu.png READY ?" + [[ $XDG_SESSION_TYPE == 'x11' ]] && xdg-open ~/.zen/tmp/g1voeu.png - LP=$(ls /dev/usb/lp* | head -n1) + LP=$(ls /dev/usb/lp* 2>/dev/null | head -n1) [[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" && continue echo "IMPRESSION LIEN TW VOEU" diff --git a/tools/new_file_in_astroport.sh b/tools/new_file_in_astroport.sh index 22eca1f3..6772bc0b 100755 --- a/tools/new_file_in_astroport.sh +++ b/tools/new_file_in_astroport.sh @@ -307,7 +307,7 @@ then echo '[ { "text": "'${TEXT}'", - "title": "'${TITLE}'", + "title": "'${TITLE//_/ }'", "season": "'${SAISON}'", "created": "'${MOATS}'", "resolution": "'${RES}'",