From db72246364207a4b032085b64fe54df159491679 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 10 Dec 2022 21:11:12 +0100 Subject: [PATCH] get cookies from default browser USER to PLAYER --- ASTROBOT/G1CopierYoutube.sh | 2 ++ ASTROBOT/PLAYER.refresh.sh | 9 ++++----- start.sh | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ASTROBOT/G1CopierYoutube.sh b/ASTROBOT/G1CopierYoutube.sh index 441730c0..900c9893 100755 --- a/ASTROBOT/G1CopierYoutube.sh +++ b/ASTROBOT/G1CopierYoutube.sh @@ -117,10 +117,12 @@ if [[ ! ${TIDDLER} ]]; then ############################################################################# ## COPY FROM YOUTUBE (TODO DOUBLE COPY & MKV to MP4 OPTIMISATION) + BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser ## EXTRA PARAM TO TRY # --cookies-from-browser browser (xdg-settings get default-web-browser) allow member copies # --dateafter DATE --download-archive myarchive.txt yt-dlp -f "(bv*[ext=mp4][height<=720]+ba/b[height<=720])" \ + --cookies-from-browser $BROWSER \ --download-archive $HOME/.zen/.yt-dlp.list \ -S "filesize:700M" --no-mtime --embed-thumbnail --add-metadata \ --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs \ diff --git a/ASTROBOT/PLAYER.refresh.sh b/ASTROBOT/PLAYER.refresh.sh index 1fc36d39..85de3983 100755 --- a/ASTROBOT/PLAYER.refresh.sh +++ b/ASTROBOT/PLAYER.refresh.sh @@ -45,7 +45,7 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do ## MY PLAYER ipfs key export $G1PUB -o ~/.zen/tmp/${MOATS}/$PLAYER.key - ipfs key import $PLAYER ~/.zen/tmp/${MOATS}/$PLAYER.key + [[ ! $(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1) ]] && ipfs key import $PLAYER ~/.zen/tmp/${MOATS}/$PLAYER.key rm -f ~/.zen/tmp/${MOATS}/$PLAYER.key ## REFRESH CACHE @@ -57,11 +57,10 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( [[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost" echo "Getting latest online TW..." - YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) - echo "($YOU) /ipns/$ASTRONAUTENS $LIBRA" - [[ $YOU ]] && ipfs --timeout 30s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \ - || curl -m 30 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" + echo "/ipns/$ASTRONAUTENS on $LIBRA" + ipfs --timeout 60s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \ + || curl -m 30 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" ## PLAYER TW IS ONLINE ? if [ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ]; then diff --git a/start.sh b/start.sh index 539b1a39..391c265e 100755 --- a/start.sh +++ b/start.sh @@ -140,7 +140,7 @@ select fav in "${choices[@]}"; do echo "Enter to continue. Ctrl+C to stop" read ipfs key rm $PLAYER; ipfs key rm $G1PUB; - for voeu in $(ls ~/.zen/game/players/$PLAYER/voeux/); do + for voeu in $(ls ~/.zen/game/players/$PLAYER/voeux/ 2>/dev/null); do ipfs key rm $voeu [[ $voeu != "" ]] && rm -Rf ~/.zen/game/world/$voeu done