From f535f7144c10e37a2b55d7863aca216cef7045dd Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 19 Nov 2022 21:28:00 +0100 Subject: [PATCH] SAISON fool proof --- ajouter_media.sh | 13 ++++++++----- tools/vlc_webcam.sh | 17 +++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ajouter_media.sh b/ajouter_media.sh index 74f87c2c..224bbc05 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -105,10 +105,15 @@ if [[ $1 == "on" ]]; then REP=$(~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON) && zenity --warning --width 600 --text "$REP" fi +espeak "restart IPFS daemon" +sudo systemctl restart ipfs + ## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING 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) [[ ! $YOU ]] && espeak "I P F S not running - EXIT" && exit 1 +espeak "Ready !" + ######################################################################## # CHOOSE CATEGORY (remove anime, not working!) [[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre media" --entry-text="Vlog" Film Serie Youtube Video) @@ -426,7 +431,7 @@ RES=${FILE_RES%?}0p # Rounding. Replace last digit with 0 # VIDEO SEASON or SAGA [[ "${CAT}" == "serie" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saison" --text "Indiquez SAISON et EPISODE. Exemple: S02E05" --entry-text="") [[ "${CAT}" == "film" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saga" --text "Indiquez une SAGA (optionnel). Exemple: James Bond" --entry-text="") -[[ $SAISON ]] && SAISON=" - $SAISON" +[[ $SAISON ]] && SAISON="_$SAISON" # VIDEO GENRES FILM_GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut}\ @@ -478,11 +483,9 @@ FILM_GENRES=$(zenity --list --checklist --title="GENRE" --height=${haut}\ GENRES="[\"$(echo ${FILM_GENRES} | sed s/\|/\",\"/g)\"]" ######################################################################## -# Screen capture is used as thumbnail +# Screen capture ######################################################################## if [[ $(echo $DISPLAY | cut -d ':' -f 1) == "" ]]; then - zenity --warning --width 300 --text "Cliquez nous capturons votre écran comme vignette MEDIA" - sleep 1 import -window root /tmp/screen.png fi @@ -562,7 +565,7 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/i esac ## Extract thumbnail -MIME=$(file --mime-type -b $HOME/astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT}) +MIME=$(file --mime-type -b "$HOME/astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT}") [[ $(echo $MIME | grep video) ]] && ffmpeg -i $HOME/astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT} -r 1/300 -vf scale=-1:120 -vcodec png $HOME/astroport/${CAT}/${MEDIAID}/thumbnail.png [[ ! -f ~/astroport/${CAT}/${MEDIAID}/thumbnail.png ]] && echo "DEFAULT THUMBNAIL NEEDED" diff --git a/tools/vlc_webcam.sh b/tools/vlc_webcam.sh index e7aa298d..165f20d4 100755 --- a/tools/vlc_webcam.sh +++ b/tools/vlc_webcam.sh @@ -48,14 +48,15 @@ fi mkdir -p ~/.zen/tmp/ espeak "Hello" -espeak "Getting player latest TW. please wait." -## GETTING LAST TW via IPFS or HTTP GW -[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 6s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/vlc_webcam.html -[[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 6 -so ~/.zen/tmp/vlc_webcam.html "$LIBRA/ipns/${ASTRONAUTENS}" -[[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && espeak "WARNING. impossible to find your TW online" -[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No local copy found !" && exit 1 -[[ -s ~/.zen/tmp/vlc_webcam.html ]] && cp -f ~/.zen/tmp/vlc_webcam.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html && espeak "OK DONE" - +if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.pubkey ]]; then + espeak "Getting player latest TW. please wait." + ## GETTING LAST TW via IPFS or HTTP GW + [[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/vlc_webcam.html + [[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/vlc_webcam.html "$LIBRA/ipns/${ASTRONAUTENS}" + [[ ! -s ~/.zen/tmp/vlc_webcam.html ]] && espeak "WARNING. impossible to find your TW online" + [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No local copy found !" && exit 1 + [[ -s ~/.zen/tmp/vlc_webcam.html ]] && cp -f ~/.zen/tmp/vlc_webcam.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html && espeak "OK DONE" +fi espeak "Start Video recording. Press ENTER to stop !" # Find "input-slave" :: pactl list short sources