This commit is contained in:
fred 2022-11-20 12:57:41 +01:00
parent f535f7144c
commit 5c8fe7ac4e
5 changed files with 111 additions and 259 deletions

View File

@ -403,17 +403,17 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
[[ ! -s ~/.zen/tmp/coucou/${MOATS}.astroindex.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/coucou/${MOATS}.astroindex.html "$LIBRA/ipns/${ASTRONAUTENS}"
# DEBUG
# echo "tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'"
# echo "cat ~/.zen/tmp/miz.json | jq -r .[].secret"
# echo "tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'"
# echo "cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret"
if [[ -s ~/.zen/tmp/coucou/${MOATS}.astroindex.html ]]; then
echo "GOT TW CACHE !!"
tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
SECRET=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
SECRET=$(cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret)
[[ ! $SECRET ]] && (echo "$HTTPCORS SECRET ERROR - SORRY - CANNOT CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "BAD SECRET (☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && continue
#
# CRYPTO DECODING CRYPTIP -> myIP
cat ~/.zen/tmp/miz.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/myIP.$G1PUB.enc.2
cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/myIP.$G1PUB.enc.2
$MY_PATH/tools/natools.py decrypt -f pubsec -k ~/.zen/tmp/coucou/${MOATS}.secret.key -i ~/.zen/tmp/myIP.$G1PUB.enc.2 -o ~/.zen/tmp/myIP.$G1PUB > /dev/null 2>&1
GWIP=$(cat ~/.zen/tmp/myIP.$G1PUB > /dev/null 2>&1)
@ -423,12 +423,21 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
echo "WAS $GWIP ($TUBE) BECOMING TW GATEWAY : $myIP" ## BECOMING OFFICIAL BECOME R/W TW
####################
echo $GWIP > ~/.zen/tmp/GWIP
$MY_PATH/tools/natools.py encrypt -p $G1PUB -i $HOME/.zen/tmp/GWIP -o $HOME/.zen/tmp/myIP.$G1PUB.enc
CRYPTIP=$(cat ~/.zen/tmp/myIP.$G1PUB.enc | base16)
## WRITE CRYPTIP into MadeInZion tiddler
echo "# CRYPTO ENCODING $GWIP -> $CRYPTIP"
sed -i "s~$SECRET~$CRYPTIP~g" ~/.zen/tmp/MadeInZion.json
###########################
# Modification Tiddlers de contrôle de GW & API
echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"http://'$myIP':5001"}]' > ~/.zen/tmp/5001.json
echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"http://'$myIP':8080"}]' > ~/.zen/tmp/8080.json
tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html \
--import "$HOME/.zen/tmp/MadeInZion.json" "application/json" \
--import "$HOME/.zen/tmp/5001.json" "application/json" \
--import "$HOME/.zen/tmp/8080.json" "application/json" \
--output ~/.zen/tmp/coucou --render "$:/core/save/all" "${MOATS}.newindex.html" "text/plain"
@ -453,6 +462,7 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
fi
## CREATE $PLAYER IPNS KEY (for next 20h12)
ipfs key rm ${PLAYER}
ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key
[[ ! -d ~/.zen/game/players/$PLAYER/ipfs/moa ]] && mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa/
cp ~/.zen/tmp/coucou/${MOATS}.astroindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html

View File

@ -59,8 +59,8 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
echo "$LIBRA/ipns/$ASTRONAUTENS"
echo "http://$myIP:8080/ipns/$ASTRONAUTENS ($YOU)"
[[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \
|| curl -m 12 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS"
[[ $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"
## PLAYER TW IS ONLINE ?
if [ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ]; then
@ -72,7 +72,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
echo "------------------------------------------------"
echo "http://$myIP:8080/ipfs/"
cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.*
echo "ipfs name publish -t 72h --key=$PLAYER /ipfs/"
echo "ipfs name publish -t 24h --key=$PLAYER /ipfs/"
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
continue
@ -81,16 +81,16 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
## FOUND TW
#############################################################
## CHECK IF myIP IS ACTUAL OFFICIAL GATEWAY
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
SECRET=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
[[ ! $SECRET ]] && (echo "$HTTPCORS SECRET ERROR - SORRY - CANNOT CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && echo "BAD SECRET (☓‿‿☓) Execution time was "`expr $(date +%s) - $start` seconds. && continue
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html --output ~/.zen/tmp --render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
SECRET=$(cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret)
[[ ! $SECRET ]] && echo "$HTTPCORS SECRET ERROR - CONTINUE " && continue
#
# CRYPTO DECODING CRYPTIP -> myIP
cat ~/.zen/tmp/miz.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/myIP.$G1PUB.enc.2
cat ~/.zen/tmp/MadeInZion.json | jq -r .[].secret | base16 -d > ~/.zen/tmp/myIP.$G1PUB.enc.2
$MY_PATH/../tools/natools.py decrypt -f pubsec -k ~/.zen/game/players/$PLAYER/secret.dunikey -i ~/.zen/tmp/myIP.$G1PUB.enc.2 -o ~/.zen/tmp/myIP.$G1PUB > /dev/null 2>&1
GWIP=$(cat ~/.zen/tmp/myIP.$G1PUB > /dev/null 2>&1)
[[ ! $GWIP ]] && GWIP=$SECRET ## CLEAR
[[ ! $GWIP ]] && GWIP=$myIP ## CLEAR
echo "TW is on $GWIP"
@ -134,12 +134,21 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
echo "# TUBE as 8080 & 5001"
TUBE=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 3)
####################
echo "# CRYPTO ENCODING $GWIP -> CRYPTIP"
echo $GWIP > ~/.zen/tmp/GWIP
$MY_PATH/../tools/natools.py encrypt -p $G1PUB -i $HOME/.zen/tmp/GWIP -o $HOME/.zen/tmp/myIP.$G1PUB.enc
CRYPTIP=$(cat ~/.zen/tmp/myIP.$G1PUB.enc | base16)
## WRITE CRYPTIP into MadeInZion tiddler
sed -i "s~$SECRET~$CRYPTIP~g" ~/.zen/tmp/MadeInZion.json
###########################
# Modification Tiddlers de contrôle de GW & API
echo '[{"title":"$:/ipfs/saver/api/http/localhost/5001","tags":"$:/ipfs/core $:/ipfs/saver/api","text":"http://'$TUBE':5001"}]' > ~/.zen/tmp/5001.json
echo '[{"title":"$:/ipfs/saver/gateway/http/localhost","tags":"$:/ipfs/core $:/ipfs/saver/gateway","text":"http://'$TUBE':8080"}]' > ~/.zen/tmp/8080.json
tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \
--import "$HOME/.zen/tmp/MadeInZion.json" "application/json" \
--import "$HOME/.zen/tmp/5001.json" "application/json" \
--import "$HOME/.zen/tmp/8080.json" "application/json" \
--output ~/.zen/tmp/${IPFSNODEID}/${PLAYER} --render "$:/core/save/all" "newindex.html" "text/plain"
@ -149,13 +158,6 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
&& rm ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/newindex.html
###########################
# [[ $GWIP == $SECRET ]]
echo "# CRYPTO ENCODING $GWIP -> CRYPTIP"
echo $GWIP > ~/.zen/tmp/GWIP
$MY_PATH/../tools/natools.py encrypt -p $G1PUB -i $HOME/.zen/tmp/GWIP -o $HOME/.zen/tmp/myIP.$G1PUB.enc
CRYPTIP=$(cat ~/.zen/tmp/myIP.$G1PUB.enc | base16)
sed -i "s~$GWIP~$CRYPTIP~g" ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
####################
## ANY CHANGES ?
@ -178,7 +180,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
ipfs name publish --allow-offline -t 72h --key=$PLAYER /ipfs/$TW
ipfs name publish --allow-offline -t 24h --key=$PLAYER /ipfs/$TW
[[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
@ -204,7 +206,7 @@ NSIZE=$(du -b ~/.zen/tmp/${IPFSNODEID} | tail -n 1 | cut -f 1)
[[ $BSIZE != $NSIZE ]] \
&& ROUTING=$(ipfs add -rwq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 ) \
&& echo "BALISE STATION /ipns/${IPFSNODEID} INDEXES = $NSIZE octets" \
&& ipfs name publish --allow-offline -t 72h /ipfs/$ROUTING
&& ipfs name publish --allow-offline -t 24h /ipfs/$ROUTING
echo "PLAYER.refresh DONE."

View File

@ -105,7 +105,7 @@ if [[ $1 == "on" ]]; then
REP=$(~/.zen/Astroport.ONE/tools/cron_VRFY.sh ON) && zenity --warning --width 600 --text "$REP"
fi
espeak "restart IPFS daemon"
espeak "restart I P F S daemon"
sudo systemctl restart ipfs
## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING
@ -386,7 +386,7 @@ exit 0
########################################################################
film | serie)
espeak "thank you for sharing your best movies"
espeak "please select your file"
# SELECT FILE TO ADD TO ASTROPORT/KODI
FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter")
@ -416,12 +416,20 @@ MEDIAID=$CMED
MEDIAKEY="TMDB_$MEDIAID"
# VIDEO TITLE
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez le titre de la vidéo" --entry-text="${FILE_TITLE}")
### CHECK IF PREVIOUS ajouter_video (Serie case)
[[ -f ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt ]] \
&& PRE=$(cat ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt | cut -d ';' -f 4) \
|| PRE=${FILE_TITLE}
###
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez le titre de la vidéo" --entry-text="${PRE}")
[[ $TITLE == "" ]] && exit 1
TITLE=$(echo "${TITLE}" | sed "s/[(][^)]*[)]//g" | sed -e 's/;/_/g' ) # Clean TITLE (NO ;)
# VIDEO YEAR
YEAR=$(zenity --entry --width 300 --title "Année" --text "Indiquez année de la vidéo. Exemple: 1985" --entry-text="")
### CHECK IF PREVIOUS ajouter_video (Serie case)
[[ -f ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt ]] \
&& PRE=$(cat ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt | cut -d ';' -f 3)
YEAR=$(zenity --entry --width 300 --title "Année" --text "Indiquez année de la vidéo. Exemple: 1985" --entry-text="${PRE}")
# VIDEO RESOLUTION
FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${FILE}" | cut -d "x" -f 2)
@ -429,7 +437,10 @@ RES=${FILE_RES%?}0p # Rounding. Replace last digit with 0
#RES=$(zenity --entry --width 300 --title="Résolution" --text="Résolution de la vidéo" --entry-text="${FILE_RES}" SD HD 4K 360p 480p 720p 1080p)
# VIDEO SEASON or SAGA
[[ "${CAT}" == "serie" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saison" --text "Indiquez SAISON et EPISODE. Exemple: S02E05" --entry-text="")
### CHECK IF PREVIOUS ajouter_video (Serie case)
[[ -f ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt ]] \
&& PRE=$(cat ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt | cut -d ';' -f 5 | cut -d '_' -f 2)
[[ "${CAT}" == "serie" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saison" --text "Indiquez SAISON et EPISODE. Exemple: S02E05" --entry-text="${PRE}")
[[ "${CAT}" == "film" ]] && SAISON=$(zenity --entry --width 300 --title "${CHOICE} Saga" --text "Indiquez une SAGA (optionnel). Exemple: James Bond" --entry-text="")
[[ $SAISON ]] && SAISON="_$SAISON"
@ -486,14 +497,15 @@ GENRES="[\"$(echo ${FILM_GENRES} | sed s/\|/\",\"/g)\"]"
# Screen capture
########################################################################
if [[ $(echo $DISPLAY | cut -d ':' -f 1) == "" ]]; then
import -window root /tmp/screen.png
sleep 1
import -window root ~/.zen/tmp/screen.png
fi
###################################
### MOVING FILE TO ~/astroport ####
###################################
mkdir -p ~/astroport/${CAT}/${MEDIAID}/
mv /tmp/screen.png ~/astroport/${CAT}/${MEDIAID}/screen.png
mv ~/.zen/tmp/screen.png ~/astroport/${CAT}/${MEDIAID}/screen.png
mv -f "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${MEDIAID}/${TITLE}${SAISON}.${FILE_EXT}"
@ -567,7 +579,8 @@ esac
## Extract thumbnail
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
rm ~/astroport/${CAT}/${MEDIAID}/thumbnail.png
[[ $(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"
########################################################################
@ -649,22 +662,24 @@ zenity --warning --width 320 --text "Ajout à votre TW ${PLAYER}"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
## GETTING LAST TW via IPFS or HTTP GW
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/ajouter_media.html
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/ajouter_media.html "$LIBRA/ipns/${ASTRONAUTENS}"
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && espeak "WARNING. impossible to find your TW online"
rm ~/.zen/tmp/ajouter_media.html
[[ $YOU ]] && echo " ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/ajouter_media.html
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && echo "curl -m 12 $LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/ajouter_media.html "$LIBRA/ipns/${ASTRONAUTENS}"
[[ ! -s ~/.zen/tmp/ajouter_media.html ]] && espeak "WARNING. WARNING. impossible to find your TW online"
[[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ]] && espeak "FATAL ERROR. No player TW copy found ! EXIT" && exit 1
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
[[ -s ~/.zen/tmp/ajouter_media.html ]] && cp -f ~/.zen/tmp/ajouter_media.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html && espeak "TW Found"
espeak "Updating IPNS. Please wait..."
###############################
echo "Nouveau MEDIAKEY dans TW $PSEUDO / ${PLAYER} : http://$myIP:8080/ipns/$ASTRONAUTENS"
tiddlywiki --verbose --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
tiddlywiki --load ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html \
--import ~/astroport/${CAT}/${MEDIAID}/${MEDIAKEY}.dragdrop.json "application/json" \
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
if [[ -s ~/.zen/tmp/newindex.html ]]; then
espeak "I P N S Publishing. Please wait..."
cp ~/.zen/tmp/newindex.html ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html
[[ $DIFF ]] && cp ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain \
~/.zen/game/players/${PLAYER}/ipfs/moa/.chain.$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats)
@ -679,8 +694,13 @@ espeak "Updating IPNS. Please wait..."
echo "${PLAYER} : http://$myIP:8080/ipns/$ASTRONAUTENS"
echo "================================================"
echo
else
espeak "Warning. Could not import Tiddler. You must add it by hand."
fi
espeak "Well done my friend. You are feeding the blob. Happy TW"
espeak "Bye Bye"
exit 0

View File

@ -201,228 +201,41 @@ echo "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/${APPNAME}/${MIME}/${M
URLENCODE_FILE_NAME=$(echo ${file} | jq -Rr @uri)
#~ ### MEDIAKEY FORGE
#~ ########################################################################
#~ ## CREATE NEW ipns KEY : ${MEDIAKEY}
#~ ########################################################################
#~ ## IPFS SELF IPNS DATA STORAGE
#~ ## ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
#~ ########################################################################
#~ if [[ ! $(ipfs key list | grep -w "${MEDIAKEY}") ]]; then
#~ echo "CREATING NEW IPNS $MEDIAKEY"
#~ ## IPNS KEY CREATION ?
#~ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}
#~ KEY=$(ipfs key gen "${MEDIAKEY}")
#~ # KEYFILE=$(ls -t ~/.ipfs/keystore/ | head -n 1) # get name of last created key (could be fooled during stargate exchange)
#~ KEYFILE=$(~/.zen/Astroport.ONE/tools/give_me_keystore_filename.py "${MEDIAKEY}") # better method applied
#~ fi
### MEDIAKEY FORGE
########################################################################
## CREATE NEW ipns KEY : ${MEDIAKEY}
########################################################################
## IPFS SELF IPNS DATA STORAGE
## ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
########################################################################
if [[ ! $(ipfs key list | grep -w "${MEDIAKEY}") ]]; then
echo "CREATING NEW IPNS $MEDIAKEY"
## IPNS KEY CREATION ?
mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}
KEY=$(ipfs key gen "${MEDIAKEY}")
KEYFILE=$(~/.zen/Astroport.ONE/tools/give_me_keystore_filename.py "${MEDIAKEY}") # better method applied
fi
#~ ## IS IT NEW IPNS KEY?
#~ if [[ $KEY ]]; then
#~ # memorize IPNS key filename for easiest exchange
#~ echo "$KEYFILE" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename
#~ # Publishing IPNS key
#~ echo "$KEY" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link
#~ # CREATE .zen = ZEN economic value counter
#~ touch ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.zen
#~ # CREATE other encrypted copies for friends depending DEFCON & stars
#~ # > STARGATE 1 - 2 - 3 - 4 - 5 !!
#~ ################ ENCRYPT keystore/$KEYFILE
#~ else
#~ KEY=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link)
#~ KEYFILE=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename)
#~ echo "## ALREADY EXISTING IPNS KEY $KEYFILE ($KEY)"
#~ fi
#~ [[ ! $KEY ]] && echo "FATAL ERROR" && exit 1
#~ ########################################################################
#~ ## add default metadata (TODO = use json file?)
#~ ########################################################################
#~ echo "${FILE_BSIZE}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.filesize
#~ echo "${file}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfs.filename
#~ echo "${TITLE}" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.title
#~ echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.timestamp
#~ ## INIT MEDIAKEY .views.counter
#~ echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.views.counter
#~ ########################################################################
#~ ########################################################################
#~ # Prepare IPFS links (then cyphered to manage exchange regulation)
#~ ########################################################################
#~ echo "/ipfs/$IPFSREPFILEID/${file}" > ~/.zen/tmp/.ipfs.filelink
#~ echo "$IPFSID" > ~/.zen/tmp/.ipfsid
#~ ########################################################################
#~ ########################################################################
#~ ################ ask autoPIN to one shuffle A_boostrap_nodes
#~ ########################################################################
#~ PINIPFSnode=$(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | shuf | tail -n 1)
#~ nodeid=${PINIPFSnode##*/}
#~ PINnode=$(~/.zen/Astroport.ONE/tools/ipfs_to_g1.py $nodeid)
#~ echo "ASK AUTOPIN to $PINnode"
#~ ## CREATE $PINnode IPFS communication directory
#~ if [[ ! -d ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode} && "$PINnode" != "$G1PUB" ]]; then
#~ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}
#~ ## ENCRYPT .ipfsid & .ipfs.filelink (THESE FILES ARE
#~ $MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/.ipfs.filelink -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfs.filelink.encrypt"
#~ $MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/.ipfsid -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipfsid.encrypt"
#~ # .ipfsid.encrypt is searched by each Station running ./zen/tools/autoPINfriends.sh
#~ fi
#~ ## Ask PIN to myself
#~ mkdir -p ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/.ipfs.filelink -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfs.filelink.encrypt"
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/.ipfsid -o "~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${G1PUB}/.ipfsid.encrypt"
#~ ########################################################################
#~ ## GREAT natools can convert IPNS MEDIAKEY into .dunikey file
#~ ########################################################################
#~ # CREATING QRCODE
#~ $MY_PATH/natools.py privkey -f ipfs-keystore -k $HOME/.ipfs/keystore/$KEYFILE -F pubsec -o ~/.zen/tmp/${MEDIAKEY}.dunikey
#~ # PubFromDunikey=$(cat ~/.zen/tmp/${MEDIAKEY}.dunikey | grep "sec" | cut -d ' ' -f2 | base58 -d | tail -c+33 | base58) ## HOWTO EXTRACT PUBKEY FROM SECKEY
#~ PubFromDunikey=$(cat ~/.zen/tmp/${MEDIAKEY}.dunikey | grep "pub" | cut -d ' ' -f2)
#~ qrencode -s 6 -o "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/QR.png" "$PubFromDunikey"
#~ echo "$PubFromDunikey" > $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/MEDIAPUBKEY
#~ ########################################################################
#~ ## MEDIAKEY => DUNIKEY + PASS 6 DIGITS openssl protection
#~ ########################################################################
#~ PASS=$(echo "${RANDOM}${RANDOM}${RANDOM}${RANDOM}" | tail -c-7) && echo "$PASS" > ~/.zen/tmp/${MEDIAKEY}.pass
#~ openssl enc -aes-256-cbc -salt -in ~/.zen/tmp/${MEDIAKEY}.dunikey -out "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -k $PASS
#~ ## STATION & BOOTSTRAP ACCESS TO PASS
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i ~/.zen/tmp/${MEDIAKEY}.pass -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt
#~ $MY_PATH/natools.py encrypt -p $PINnode -i ~/.zen/tmp/${MEDIAKEY}.pass -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.pass.encrypt
#~ ## DECODE MEDIAKEY.dunikey ##
#~ # ~/.zen/Astroport.ONE/tools/natools.py decrypt -f pubsec -k "$HOME/.zen/secret.dunikey" -i "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.pass.encrypt" -o "~/.zen/tmp/${MEDIAKEY}.pass"
#~ # openssl enc -aes-256-cbc -d -in "$HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/dunikey.enc" -out "~/.zen/tmp/${MEDIAKEY}.dunikey" -k $(cat "~/.zen/tmp/${MEDIAKEY}.pass")
#~ rm ~/.zen/tmp/${MEDIAKEY}.dunikey
#~ ########################################################################
#~ ## GET .ipfs/keystore file MAHE .ipns.mediakey.encrypt
#~ # used in ipns_TAG_refresh.sh & autoPINfriends.sh (TODO RUN AGAIN?)
#~ ########################################################################
#~ $MY_PATH/natools.py encrypt -p $G1PUB -i $HOME/.ipfs/keystore/$KEYFILE -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.mediakey.encrypt
#~ $MY_PATH/natools.py encrypt -p $PINnode -i $HOME/.ipfs/keystore/$KEYFILE -o $HOME/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.ipns.mediakey.encrypt
#~ ## Init zen, views counters & visitor
#~ echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.zen
#~ echo "0" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.views.counter
#~ echo "anonymous" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/${PINnode}/.visitor
#~ ########################################################################
#~ # MEMORIZE my PIN
#~ mkdir -p ~/.zen/PIN/${IPFSREPFILEID}/
#~ touch ~/.zen/PIN/${IPFSREPFILEID}/${G1PUB}
#~ # echo "$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)" > ~/.zen/PIN/${ipfsrepidfile}/IPNSLINK # NO!! CHOOSE TODO Would let PINing nodes change index.html///
#~ ########################################################################
#~ ## encrypt links for myself
#~ ########################################################################
#~ $MY_PATH/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/.ipfs.filelink -o ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfs.filelink.natools.encrypt
#~ $MY_PATH/natools.py encrypt -p ${G1PUB} -i ~/.zen/tmp/.ipfsid -o ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipfsid.encrypt
#~ rm ~/.zen/tmp/.ipfs.filelink
#~ rm ~/.zen/tmp/.ipfsid
#~ ########################################################################
#~ ########################################################################
#~ ## ADD "ajouter_video.txt" and "video.json" will be SELF IPNS publish data
#~ ## ENCRYPT TO STOP CLEAR DATA LEAKING
#~ [[ -f ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt ]] && cp -f ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
#~ [[ -f ~/astroport/${TyPE}/${REFERENCE}/screen.png ]] && cp -f ~/astroport/${TyPE}/${REFERENCE}/screen.png ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
#~ [[ -f ~/astroport/${TyPE}/${REFERENCE}/youtube.png ]] && cp -f ~/astroport/${TyPE}/${REFERENCE}/youtube.png ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/screen.png
#~ [[ -f ~/astroport/${TyPE}/${REFERENCE}/video.json ]] &&\
#~ cp -f ~/astroport/${TyPE}/${REFERENCE}/video.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/ &&\
#~ cp -f ~/astroport/${TyPE}/${REFERENCE}/video.json ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
#~ ########################################################################
#~ ########################################################################
#~ ## EXPLANATIONS
#~ ########################################################################
#~ # What is being in ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/
#~ # is published on http://${myIP}:8080/ipns/$KEY/ AND ipfs ls /ipns/$KEY/
#~ ########################################################################
#~ ########################################################################
#~ # CONTRACTS, are small App (fulljs or jquery + nginx backend app server)
#~ # They must decrypt IPFS after succeeding a chalenge (, +/- n zen, ...)
#~ ########################################################################
#~ # Contract App Examples (ipns_TAG_refresh.sh makes MEDIAKEY evolution)
#~ # Counting video views = +1 .views.counter => decrypt key
#~ # Balancing Zen wallets = -n form source = +n for destination => decrypt key
#~ ########################################################################
#~ # Astroport/Gchange USE as public/private media copy friend of friends swarm
#~ # one star level (no encrypt)
#~ # index.html is presenting Astroport/Kodi service then redirect to
#~ # $G1PUB/index.html contains redirection to ipfs link
#~ ## NEW RELEASE
#~ ## Create TW5 index.html to give easy control access to MEDIAKEY and KEY owner
#~ ########################################################################
#~ ########################################################################
#~ ## IPNS access to index.html
#~ ## Level 1 (not crypted) -> Redirect to ipfs streaming link
#~ IPNSLINK=$(ipfs key list -l | grep -w ${MEDIAKEY} | cut -d ' ' -f 1)
#~ ## FIRST REDIRECT PAGE ${MEDIAKEY}/index.html
#~ # https://tube.copylaradio.com/ipns/$IPNSLINK
#~ #envsubst < ./www/boris/youtube_watch_step2.html > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
#~ echo "=======> Mediakey Welcome index.html "
#~ cat ~/.zen/Astroport.ONE/templates/boris/youtube_watch_step2.html \
#~ | sed "s/_IPNSLINK_/$IPNSLINK/g" \
#~ | sed "s/_IPFSNODEID_/$IPFSNODEID/g" \
#~ | sed "s/_PLAYER_/$PLAYER/g" \
#~ | sed "s/_G1PUB_/$G1PUB/g" \
#~ | sed "s/_TITLE_/$TITLE/g" \
#~ > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
#~ ## SECOND REDIRECT PAGE ${MEDIAKEY}/${G1PUB}/index.html
#~ # https://tube.copylaradio.com/ipns/$IPNSLINK/${G1PUB}/
#~ # envsubst < ../www/boris/youtube_watch_step3.html > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
#~ echo "=======> Mediakey Contract index.html "
#~ cat ~/.zen/Astroport.ONE/templates/boris/youtube_watch_step3.html \
#~ | sed "s/_TITLE_/$TITLE/g" \
#~ | sed "s/_IPFSNODEID_/$IPFSNODEID/g" \
#~ | sed "s/_PLAYER_/$PLAYER/g" \
#~ | sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" \
#~ | sed "s/_URLENCODE_FILE_NAME_/$URLENCODE_FILE_NAME/g" \
#~ > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
#~ # echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://${myIP}:8080/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
#~ ########################################################################
#~ ## TODO ACTIVATE "./zen/ipns_TAG_refresh.sh" (SACEM & Netflix Buziness is HERE!! Add your crypto/contracts there)
#~ ########################################################################
#~ ########################################################################
#~ ########################################################################
#~ ## PUBLISH new IPNS
#~ ########################################################################
#~ echo "$(date -u +%s%N | cut -b1-13)" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.timestamp
#~ echo "ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/"
#~ NEWIPFS=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1 )
#~ [[ "$NEWIPFS" == "" ]] && echo "~~~ FAILURE ~~~ ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/ | tail -n 1" && exit 1
#~ ## ADD CHAIN BLOCK ZERO (will be updated by ipns_TAG_refresh.sh)
#~ echo $NEWIPFS > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/.chain
#~ echo "ipfs name publish --quieter --key=${MEDIAKEY} $NEWIPFS"
#~ ipfs name publish -t 720h --quieter --key="${MEDIAKEY}" $NEWIPFS &
#~ IPNS="$(ipfs key list -l | grep -w ${MEDIAKEY} | cut -f 1 -d ' ')"
#~ echo "${MEDIAKEY} : /ipns/$IPNS"
#~ ########################################################################
#~ ########################################################################
## IS IT NEW IPNS KEY?
if [[ $KEY ]]; then
# memorize IPNS key filename for easiest exchange
echo "$KEYFILE" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename
# Publishing IPNS key
echo "$KEY" > ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link
# CREATE .zen = ZEN economic value counter
touch ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.zen
################ STORE ENCRYPT keystore/$KEYFILE
cp ~/.ipfs/keystore/$KEYFILE ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/
else
KEY=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.link)
KEYFILE=$(cat ~/.zen/game/players/$PLAYER/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.ipns.key.keystore_filename)
echo "## ALREADY EXISTING IPNS KEY $KEYFILE ($KEY)"
fi
########################################################################
# POST TRAITEMENTS
########################################################################
# film/serie PUBLISH "ajouter_video.txt" for KODI
# film/serie PUBLISH
########################################################################
if [[ "${type}" =~ ^(film|serie|youtube|page|video)$ ]]
then
@ -450,7 +263,7 @@ then
FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${path}${file}" | cut -d "x" -f 2)
RES=${FILE_RES%?}0p
# REFRESH ajouter_video.txt FILE
# REFRESH ${MOATS}_ajouter_video.txt FILE
if [[ -f ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt ]]
then
line=$(cat ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt | sed "s/_IPFSREPFILEID_/$IPFSREPFILEID/g" | sed "s/_IPNSKEY_/$IPNS/g" )
@ -461,6 +274,7 @@ then
echo "$line"
echo "UPDATE ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt"
echo "$line" > ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt
cp ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt ~/astroport/${TyPE}/${REFERENCE}/${MOATS}_ajouter_video.txt
########################################################################
## TODO: ACTIVATE SUB DEFCON 4 MODE = encrypt/decrypt file in $G1DEST subdirectory
@ -475,8 +289,9 @@ then
[[ $CAT == "Film" ]] && tdb="movie"
[[ $CAT == "Serie" ]] && tdb="tv"
GENRE=$(cat ~/astroport/${TyPE}/${REFERENCE}/ajouter_video.txt | cut -d ';' -f 6 | sed 's/|/ /g' | jq -r '@csv' | sed 's/ /_/g' | sed 's/,/ /g' | sed 's/\"//g' )
echo $GENRE
GENRE=$(cat ~/astroport/${TyPE}/${REFERENCE}/${MOATS}_ajouter_video.txt | cut -d ';' -f 6 | sed 's/|/ /g' | jq -r '@csv' | sed 's/ /_/g' | sed 's/,/ /g' | sed 's/\"//g' )
SAISON=$(cat ~/astroport/${TyPE}/${REFERENCE}/${MOATS}_ajouter_video.txt | cut -d ';' -f 5)
echo $GENRE $SAISON
## ASK FOR EXTRA METADATA
[[ ! $3 ]] && OUTPUT=$(zenity --forms --width 480 --title="METADATA" --text="Metadonnées (séparateur espace)" --separator="~" --add-entry="Description" --add-entry="extra tag(s)")
@ -514,6 +329,10 @@ then
CANON="/ipfs/"${IPFSID}
fi
## Archive previous dragdrop.json
[[ -s ~/astroport/${TyPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json ]] \
&& cp ~/astroport/${TyPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json ~/astroport/${TyPE}/${REFERENCE}/${MOATS}.${MEDIAKEY}.dragdrop.json
echo "## Creation json tiddler"
echo '[
{
@ -521,6 +340,7 @@ then
"title": "'${CapitalGluedTitle}'",
"created": "'${MOATS}'",
"resolution": "'${RES}'",
"season": "'${SAISON}'",
"gifanime": "'/ipfs/${ANIMH}'",
"type": "'${TidType}'",
"mime": "'${MIME}'",
@ -580,7 +400,7 @@ echo "VIDEO IPNS LINK : http://${myIP}:8080/ipns/$KEY/$G1PUB/ = Create 'G1${CAT
echo "#### EXCECUTION TIME"
end=`date +%s`
dur=`expr $end - $start`
echo ${MOATS}:${G1PUB}:${PLAYER}:NewFile:$dur >> ~/.zen/tmp/${IPFSNODEID}/_timings
echo ${MOATS}:${G1PUB}:${PLAYER}:NewFile:$dur:${MEDIAKEY} >> ~/.zen/tmp/${IPFSNODEID}/_timings
cat ~/.zen/tmp/${IPFSNODEID}/_timings | tail -n 1
echo "########################################################################"

View File

@ -181,7 +181,7 @@ echo "PLAYER TW Update..."
~/.zen/game/players/${PLAYER}/ipfs/moa/.chain.$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats)
TW=$(ipfs add -Hq ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html | tail -n 1)
ipfs name publish --allow-offline -t 72h --key=${PLAYER} /ipfs/$TW
ipfs name publish --allow-offline -t 24h --key=${PLAYER} /ipfs/$TW
[[ $DIFF ]] && echo $TW > ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain
echo $MOATS > ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats