From 704a0b71e028b362433c3f974a6afdc964d5486a Mon Sep 17 00:00:00 2001 From: fred Date: Thu, 5 Jan 2023 16:28:10 +0100 Subject: [PATCH] timing rules --- 12345.sh | 4 ++-- ASTROBOT/G1CopierYoutube.sh | 2 +- ajouter_media.sh | 30 ++++++++++++++++++++++-------- start.sh | 1 + 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/12345.sh b/12345.sh index 7429e4b5..2cdc17a1 100755 --- a/12345.sh +++ b/12345.sh @@ -25,8 +25,8 @@ PORT=12345 mkdir -p ~/.zen/tmp/coucou/ ~/.zen/game/players/localhost ## CHECK FOR ANY ALREADY RUNNING nc -ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) -[[ $ncrunning ]] && echo "ERROR - API Server Already Running - ${myASTROPORT}/?salt=totodu56&pepper=totodu56&getipns " && exit 1 +ncrunning=$(ps axf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) +[[ $ncrunning ]] && echo "RESTARTING" && kill -9 $ncrunning ## NOT RUNNING TWICE # Some client needs to respect that diff --git a/ASTROBOT/G1CopierYoutube.sh b/ASTROBOT/G1CopierYoutube.sh index d572d757..e03b45cf 100755 --- a/ASTROBOT/G1CopierYoutube.sh +++ b/ASTROBOT/G1CopierYoutube.sh @@ -213,7 +213,7 @@ else echo '# TIDDLER WAS IN CACHE' ################################################################### ## TODO : ADD EMAIL TAG ( TIMESTAMP & ADD SIGNATURE over existing ones) - + continue fi cp -f "${TIDDLER}" "$HOME/.zen/game/players/$PLAYER/G1CopierYoutube/" diff --git a/ajouter_media.sh b/ajouter_media.sh index ed16678f..571e4812 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -42,19 +42,24 @@ PLAYER="$2" CHOICE="$3" # Check who is .current PLAYER -[[ ${PLAYER} == "" ]] \ -&& players=($(ls ~/.zen/game/players | grep -Ev "localhost" 2>/dev/null)) \ -&& espeak "PLEASE CONNECT A PLAYER" \ -&& OUTPUT=$(zenity --entry --width 640 --title="=> Astroport" --text="ASTRONAUTE ?" --entry-text=${players[@]}) \ -&& [[ $OUTPUT ]] && PLAYER=$OUTPUT && rm -f ~/.zen/game/players/.current && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current +players=($(ls ~/.zen/game/players | grep -Ev "localhost" 2>/dev/null)) + +[[ ${#players[@]} -ne 1 ]] \ +&& espeak "PLEASE CONNECT A PLAYER" && OUTPUT=$(zenity --entry --width 640 --title="=> Astroport" --text="ASTRONAUTE ?" --entry-text=${players[@]}) \ +|| OUTPUT="${players}" + +echo "PLAYER = $OUTPUT" + +[[ $OUTPUT ]] && ( PLAYER=$OUTPUT && rm -f ~/.zen/game/players/.current && ln -s ~/.zen/game/players/$PLAYER ~/.zen/game/players/.current ) \ +|| espeak "NO PLAYER" [[ ${PLAYER} == "" ]] \ && ${MY_PATH}/start.sh \ -&& espeak "Astronaut. Please enter pass phrase and email of your TW" \ +&& espeak "Astronaut. Please register." \ && xdg-open "http://astroport.localhost:1234" \ && exit 1 -PSEUDO=$(myPlayerPseudo) +PSEUDO=$(myPlayerUser) espeak "Hello $PSEUDO" G1PUB=$(myPlayerG1Pub) @@ -67,14 +72,22 @@ ASTRONAUTENS=$(myAstroKey) BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser +### if [ $URL ]; then + echo "URL: $URL" REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_" [ ! $2 ] && IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="${PLAYER} Type de media à importer ?" --entry-text="Video" Page MP3 Web) || IMPORT="$CHOICE" [[ $IMPORT == "" ]] && espeak "No choice made. Exiting program" && exit 1 [[ $IMPORT == "Video" ]] && IMPORT="Youtube" CHOICE="$IMPORT" + +else + + xdg-open "$myIPFS/ipns/$ASTRONAUTENS" + fi +### ( ## SUB PROCESS # Get PLAYER wallet amount @@ -82,13 +95,14 @@ fi [[ $COINS == "" || $COINS == "null" ]] && espeak "Missing coins. Free Run." || espeak "You have $COINS Coins" ) +### # GET SCREEN DIMENSIONS screen=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/') width=$(echo $screen | cut -d 'x' -f 1) height=$(echo $screen | cut -d 'x' -f 2) large=$((width-300)) haut=$((height-200)) - +### ######################################################################## ## CADRE EXCEPTION COPIE PRIVE # https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000006278917/2008-12-11/ diff --git a/start.sh b/start.sh index 2b4fd9fe..875a05c0 100755 --- a/start.sh +++ b/start.sh @@ -20,6 +20,7 @@ echo "(RE)STARTING 12345.sh" || ( killall "12345.sh"; killall "_12345.sh"; killall "nc" ) mkdir -p ~/.zen/tmp +~/.zen/Astroport.ONE/tools/displaytimer.sh 3 ~/.zen/Astroport.ONE/12345.sh > ~/.zen/tmp/12345.log & echo $! > ~/.zen/.pid