## CHANGE SELECTED GW & API

This commit is contained in:
fred 2023-01-01 19:06:24 +01:00
parent b047d5c4bc
commit 5abbeba85f
6 changed files with 22 additions and 13 deletions

View File

@ -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
###################################################################

View File

@ -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

View File

@ -0,0 +1 @@
[{"title":"$:/ipfs/saver/api","tags":"$:/ipfs/core","text":"$:/ipfs/saver/api/http/local/5001"}]

View File

@ -0,0 +1 @@
[{"title":"$:/ipfs/saver/gateway","tags":"$:/ipfs/core","text":"$:/ipfs/saver/gateway/local/myip"}]

View File

@ -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

View File

@ -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"