From 5abbeba85fb1f53a0e2cc46c1329adcff752988a Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 1 Jan 2023 19:06:24 +0100 Subject: [PATCH] ## CHANGE SELECTED GW & API --- ASTROBOT/G1CopierYoutube.sh | 16 +++++++++------- ajouter_media.sh | 2 +- templates/tw/$ _ipfs_saver_api.json | 1 + templates/tw/$ _ipfs_saver_gateway.json | 1 + tools/VISA.new.sh | 11 ++++++++--- tools/make_video_gifanim_ipfs.sh | 4 ++-- 6 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 templates/tw/$ _ipfs_saver_api.json create mode 100644 templates/tw/$ _ipfs_saver_gateway.json diff --git a/ASTROBOT/G1CopierYoutube.sh b/ASTROBOT/G1CopierYoutube.sh index ec2c6a61..fffd8937 100755 --- a/ASTROBOT/G1CopierYoutube.sh +++ b/ASTROBOT/G1CopierYoutube.sh @@ -61,21 +61,22 @@ for YURL in $(cat ~/.zen/game/players/$PLAYER/G1CopierYoutube/CopierYoutube.json if [[ ! $CMD ]]; then echo "$PLAYER&$YURL:$MOATS" >> ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command echo "NOUVEAU CANAL $PLAYER&$YURL:$MOATS" + lastrun=$MOATS + duree=604800000 else lastrun=$(echo "$CMD" | rev | cut -d ':' -f 1 | rev) && echo "$CMD" duree=$(expr ${MOATS} - $lastrun) - [[ ! $lastrun ]] && echo "$PLAYER&$YURL:$MOATS" >> ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.command && duree=604800000 + fi # ONE WEEK NEW SCAN - if [[ duree -ge 604800000 || ! -s ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER ]]; then + if [[ $duree -ge 604800000 || ! -s ~/.zen/game/players/$PLAYER/G1CopierYoutube/yt-dlp.cache.$PLAYER ]]; then yt-dlp --cookies-from-browser $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 - 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 | sort | uniq | shuf > ~/.zen/tmp/$IPFSNODEID/yt-dlp.cache.$PLAYER +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 @@ -91,9 +92,9 @@ while read LINE; ################################################################### ## Search for $YID.TW.json TIDDLER in local & MySwarm cache - echo "CACHE SEARCH..." && TIDDLER=$(ls -t ~/.zen/game/players/*/G1CopierYoutube/$YID.TW.json 2>/dev/null | head -n 1) - [[ ! $TIDDLER]] && TIDDLER=$(ls -t ~/.zen/tmp/$IPFSNODEID/G1CopierYoutube/*/$YID.TW.json 2>/dev/null | head -n 1) - [[ ! $TIDDLER]] && TIDDLER=$(ls -t ~/.zen/tmp/swarm/*/G1CopierYoutube/*/$YID.TW.json 2>/dev/null | head -n 1) + echo "--- CACHE SEARCH FOR $YID ---" && TIDDLER=$(ls -t ~/.zen/game/players/*/G1CopierYoutube/$YID.TW.json 2>/dev/null | head -n 1) + [[ ! $TIDDLER ]] && TIDDLER=$(ls -t ~/.zen/tmp/$IPFSNODEID/G1CopierYoutube/*/$YID.TW.json 2>/dev/null | head -n 1) + [[ ! $TIDDLER ]] && TIDDLER=$(ls -t ~/.zen/tmp/swarm/*/G1CopierYoutube/*/$YID.TW.json 2>/dev/null | head -n 1) [[ $TIDDLER ]] && echo "Tiddler Found in CACHE : $TIDDLER" || echo "EMPTY." ################################################################### @@ -205,6 +206,7 @@ if [[ ! ${TIDDLER} ]]; then ] ' > "$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" + TIDDLER="$HOME/.zen/tmp/$IPFSNODEID/G1CopierYoutube/$PLAYER/$YID.TW.json" else ################################################################### diff --git a/ajouter_media.sh b/ajouter_media.sh index fbaadfce..c41ad245 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -136,7 +136,7 @@ ISPUBLISHING=$(ps auxf --sort=+utime | grep -w 'ipfs name publish' | grep -v -E ######################################################################## espeak "restart I P F S daemon" -[[ "$isLAN" ]] && sudo systemctl restart ipfs && sleep 3 +[[ "$isLAN" ]] && sudo systemctl restart ipfs && sleep 7 ## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING YOU=$(myIpfsApi) [[ ! $YOU ]] && espeak "I P F S not running - EXIT" && exit 1 diff --git a/templates/tw/$ _ipfs_saver_api.json b/templates/tw/$ _ipfs_saver_api.json new file mode 100644 index 00000000..840e9d2f --- /dev/null +++ b/templates/tw/$ _ipfs_saver_api.json @@ -0,0 +1 @@ +[{"title":"$:/ipfs/saver/api","tags":"$:/ipfs/core","text":"$:/ipfs/saver/api/http/local/5001"}] diff --git a/templates/tw/$ _ipfs_saver_gateway.json b/templates/tw/$ _ipfs_saver_gateway.json new file mode 100644 index 00000000..2e76b666 --- /dev/null +++ b/templates/tw/$ _ipfs_saver_gateway.json @@ -0,0 +1 @@ +[{"title":"$:/ipfs/saver/gateway","tags":"$:/ipfs/core","text":"$:/ipfs/saver/gateway/local/myip"}] diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index 92c790fb..da39bd4f 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -179,9 +179,6 @@ WID="https://ipfs.$CLYUSER$YOMAIN.$(myHostName)/api" cat ~/.zen/Astroport.ONE/templates/data/local.api.json | sed "s~_NID_~${WID}~g" > ~/.zen/tmp/${MOATS}/local.api.json cat ~/.zen/Astroport.ONE/templates/data/local.gw.json | sed "s~_NID_~${NID}~g" > ~/.zen/tmp/${MOATS}/local.gw.json - ## $:/ipfs/saver/gateway - ## $:/ipfs/saver/api - mv ~/.zen/tmp/${MOATS}/secret.dunikey ~/.zen/game/players/$PLAYER/ # Create Player "IPNS Key" (key import) @@ -282,13 +279,21 @@ WID="https://ipfs.$CLYUSER$YOMAIN.$(myHostName)/api" echo "TW IPFS API : $WID" # cat ~/.zen/tmp/${MOATS}/local.api.json | jq -r + ## CHANGE SELECTED GW & API + ## ~/.zen/Astroport.ONE/templates/tw/$ _ipfs_saver_api.json + ## ~/.zen/Astroport.ONE/templates/tw/$ _ipfs_saver_gateway.json + + ## ADD SYSTEM TW tiddlywiki --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \ --import ~/.zen/tmp/${MOATS}/lightbeam-name.json "application/json" \ --import ~/.zen/tmp/${MOATS}/lightbeam-key.json "application/json" \ --import ~/.zen/tmp/${MOATS}/local.api.json "application/json" \ --import ~/.zen/tmp/${MOATS}/local.gw.json "application/json" \ + --import ~/.zen/Astroport.ONE/templates/tw/$ _ipfs_saver_api.json "application/json" \ + --import ~/.zen/Astroport.ONE/templates/tw/$ _ipfs_saver_gateway.json "application/json" \ --output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "newindex.html" "text/plain" + [[ -s ~/.zen/tmp/${MOATS}/newindex.html ]] && cp -f ~/.zen/tmp/${MOATS}/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ## ID CARD & QRCODE diff --git a/tools/make_video_gifanim_ipfs.sh b/tools/make_video_gifanim_ipfs.sh index db193532..cfdeaf3d 100755 --- a/tools/make_video_gifanim_ipfs.sh +++ b/tools/make_video_gifanim_ipfs.sh @@ -16,8 +16,8 @@ RES=${FILE_RES%?}0p FILE_BSIZE=$(du -b "${path}${file}" | awk '{print $1}') -DURATION=$(ffprobe -i "${path}${file}" -show_entries format=duration -v quiet -of csv="p=0" | cut -d '.' -f 1) -DUREE=$(ffprobe -i "${path}${file}" -show_entries format=duration -sexagesimal -v quiet -of csv="p=0"| cut -d '.' -f 1) +DURATION=$(ffprobe -v error -i "${path}${file}" -show_entries format=duration -v quiet -of csv="p=0" | cut -d '.' -f 1) +DUREE=$(ffprobe -v error -i "${path}${file}" -show_entries format=duration -sexagesimal -v quiet -of csv="p=0"| cut -d '.' -f 1) PROBETIME=$(echo "0.618 * $DURATION" | bc -l | cut -d '.' -f 1) [[ ! $PROBETIME ]] && PROBETIME="1.0"