From 11b776dab3413a82f876d5f3606ac1f4d7a3a30c Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 10 Mar 2024 00:50:06 +0100 Subject: [PATCH] -e "s~_MOATS_~${MOATS}~g" \ --- ASTROBOT/G1CopierYoutube.sh | 2 +- RUNTIME/PLAYER.refresh.sh | 36 ++++++++++++++++++------------ templates/data/SECTORTW_NEWS.json | 1 + templates/data/_UPPERFPLAYER_.json | 1 + 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ASTROBOT/G1CopierYoutube.sh b/ASTROBOT/G1CopierYoutube.sh index 75c2bbd7..b7e1ec8f 100755 --- a/ASTROBOT/G1CopierYoutube.sh +++ b/ASTROBOT/G1CopierYoutube.sh @@ -71,7 +71,7 @@ for YURL in $(cat ~/.zen/game/players/${PLAYER}/G1CopierYoutube/CopierYoutube.js 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} + /usr/local/bin/yt-dlp $BROWSER --print "%(id)s&%(webpage_url)s" "${YURL}" 2>/dev/null >> ~/.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 diff --git a/RUNTIME/PLAYER.refresh.sh b/RUNTIME/PLAYER.refresh.sh index f3728e79..5f36cd6e 100755 --- a/RUNTIME/PLAYER.refresh.sh +++ b/RUNTIME/PLAYER.refresh.sh @@ -227,6 +227,7 @@ for PLAYER in ${PLAYERONE[@]}; do # (RE)MAKE "SECTORTW_NEWS" TIDDLER cat ${MY_PATH}/../templates/data/SECTORTW_NEWS.json \ | sed -e "s~_SECTOR_~${SECTOR}~g" \ + -e "s~_MOATS_~${MOATS}~g" \ -e "s~_SECTORTW_~/ipns/${TODATESECTORNS}/TW~g" \ > ~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json @@ -282,27 +283,31 @@ for PLAYER in ${PLAYERONE[@]}; do ##################################################################### ## GET $:/moa Tiddlers ####################################### + echo "GET $:/moa Tiddlers" ###################################################### [tag[$:/moa]] tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \ --output ~/.zen/tmp/${MOATS} \ --render '.' 'FRIENDS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[$:/moa]]' ## $:/moa EMAIL Tiddlers ##################################################################### fplayers=($(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq -rc .[].title)) - echo "FOUND : ${fplayers[@]}" + echo "${fplayers[@]}" INPUTPLAYERS=() for fp in ${fplayers[@]}; do [[ "${fp}" == "${PLAYER}" ]] && echo "moa" && continue + FPLAYER=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .president') [[ $FPLAYER == 'null' ]] && echo "null" && continue echo "$FPLAYER coucou" + FTW=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .tw') echo "TW: $FTW" + FG1PUB=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .g1pub') echo "G1: $FG1PUB" IHASH=$(cat ~/.zen/tmp/${MOATS}/FRIENDS.json | jq .[] | jq -r 'select(.title=="'${fp}'") | .text' | sha256sum | cut -d ' ' -f 1) - echo $IHASH + echo "IHASH: $IHASH" if [[ ${FTW} != "/ipns/" && ${FTW} != "null" && ${FTW} != "" ]]; then @@ -312,24 +317,27 @@ for PLAYER in ${PLAYERONE[@]}; do --output ~/.zen/tmp/${MOATS} \ --render '.' 'finside.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '${FPLAYER^^}' ## $:/moa EMAIL Tiddlers - FIHASH=$(cat ~/.zen/tmp/${MOATS}/finside.json | jq .[] | jq -r 'select(.title=="'${FPLAYER^^}'") | .ihash') - echo $FIHASH + INSIDEH=$(cat ~/.zen/tmp/${MOATS}/finside.json | jq .[] | jq -r 'select(.title=="'${FPLAYER^^}'") | .ihash') + echo $INSIDEH ## UPDATE IF IHASH CHANGED - if [[ ! $FIHASH || $FIHASH != $IHASH ]]; then - cat ${MY_PATH}/../templates/data/_UPPERFPLAYER_.json \ - | sed -e "s~_UPPERFPLAYER_~${FPLAYER^^}~g" \ - -e "s~_FPLAYER_~${FPLAYER}~g" \ - -e "s~_IHASH_~${IHASH}~g" \ - -e "s~_FRIENDTW_~${FTW}~g" \ - -e "s~_PLAYER_~${PLAYER}~g" \ - > ~/.zen/tmp/${MOATS}/${FPLAYER}.json - - INPUTPLAYERS+=(" --import ${HOME}/.zen/tmp/${MOATS}/${FPLAYER}.json 'application/json' ") # Append to the array + if [[ ! $INSIDEH || $INSIDEH != $IHASH ]]; then + cat ${MY_PATH}/../templates/data/_UPPERFPLAYER_.json \ + | sed -e "s~_UPPERFPLAYER_~${FPLAYER^^}~g" \ + -e "s~_FPLAYER_~${FPLAYER}~g" \ + -e "s~_MOATS_~${MOATS}~g" \ + -e "s~_IHASH_~${IHASH}~g" \ + -e "s~_FRIENDTW_~${FTW}~g" \ + -e "s~_PLAYER_~${PLAYER}~g" \ + > ~/.zen/tmp/${MOATS}/${FPLAYER}.json + echo "( ---- /G |\ |Z / / /" + cat ~/.zen/tmp/${MOATS}/${FPLAYER}.json | jq + INPUTPLAYERS+=(" --import ${HOME}/.zen/tmp/${MOATS}/${FPLAYER}.json 'application/json' ") # Append to the array fi fi done + ## FRIENDS TW FLUX TO IMPORT echo "${INPUTPLAYERS[@]}" diff --git a/templates/data/SECTORTW_NEWS.json b/templates/data/SECTORTW_NEWS.json index b5a5d0b0..4338c404 100644 --- a/templates/data/SECTORTW_NEWS.json +++ b/templates/data/SECTORTW_NEWS.json @@ -1,5 +1,6 @@ [ { + "created": "_MOATS_", "text": "_SECTORTW_", "tags": "load-external _PLAYER_ $:/tags/load-external-content", "title": "_SECTOR_.NEWS", diff --git a/templates/data/_UPPERFPLAYER_.json b/templates/data/_UPPERFPLAYER_.json index de56901e..d43138df 100644 --- a/templates/data/_UPPERFPLAYER_.json +++ b/templates/data/_UPPERFPLAYER_.json @@ -1,5 +1,6 @@ [ { + "created": "_MOATS_", "title": "_UPPERFPLAYER_", "text": "\\procedure loadMyWiki()\n\\import [[$:/plugins/sq/ExternalContent/loadWikiActions]]\n<$transclude\n $variable=\"loadWikiActions\"\n wikiURL={{!!wikiURL}}\n contentFilter={{!!filter}}\n deseralizer=\"text/html\"\n />\n\\end\n\n
\n _UPPERFPLAYER_ TW:\n
\n\n<$edit size=60 field=\"wikiURL\"/> ⬅︎ TW
\n<$edit size=50 field=\"filter\"/> ⬅︎ Filtration\n\n<><$button actions=<> > _UPPERFPLAYER_ TW \n\n
\n
\n\n[[EXTERNAL|EXTERNAL]]\n \n", "tags": "_PLAYER_ $:/tags/load-external-content",