Record Vlog in Player TW

This commit is contained in:
fred 2022-08-24 15:10:56 +02:00
parent 174be0eeec
commit d19a73dbf6
4 changed files with 64 additions and 27 deletions

View File

@ -228,6 +228,11 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO
echo $IPUSH > ~/.zen/game/world/$WISHKEY/.chain
echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats
## Creating Cesium+ Profil
$MY_PATH/tools/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" set --name "G1Voeu $PEPPER" --avatar "/home/$USER/.zen/Astroport.ONE/images/logojune.jpg" --site "https://astroport.com/ipns/$VOEUXNS" #CESIUM+
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED !!!!"
echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
echo "CAPSULE A REVE $PEPPER : http://127.0.0.1:8080/ipns/$VOEUXNS"

View File

@ -78,7 +78,7 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
echo "Votre MOA : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
PS3="$PLAYER choisissez : __ "
choices=("CREER UN VOEU" "IMPRIMER VOEU" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
choices=("AJOUTER VLOG" "CREER UN VOEU" "IMPRIMER VOEU" "IMPRIMER VISA" "EXPORTER VISA" "SUPPRIMER VISA" "QUITTER")
select fav in "${choices[@]}"; do
case $fav in
"IMPRIMER VISA")
@ -111,6 +111,12 @@ select fav in "${choices[@]}"; do
break
;;
"AJOUTER VLOG")
echo "Lancement Webcam..."
${MY_PATH}/tools/vlc_webcam.sh
#~/.zen/astrXbian/ajouter_video.sh
;;
"CREER UN VOEU")
echo "QRCode à coller sur votre REVE"
${MY_PATH}/G1VOEUX.sh

View File

@ -20,7 +20,7 @@ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "http
########################################################################
#echo "CREATING $PLAYER CESIUM+ PROFILE"
########################################################################
#$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.e-is.pro" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+
#$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/astrXbian/logo.png" --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+
#[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" && exit 1
########################################################################

View File

@ -31,7 +31,6 @@ mkdir -p ~/.zen/tmp/
PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) || ( espeak "no player. EXIT" && exit 1 )
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null) || ( espeak "no pseudo. EXIT" && exit 1 )
G1PUB=$(cat ~/.zen/game/players/.current/.g1pub 2>/dev/null) || ( espeak "no g1 pub" && exit 1 )
IPFSNODEID=$(cat ~/.zen/game/players/.current/.ipfsnodeid 2>/dev/null) || ( espeak "no ipfs node id" && exit 1 )
espeak "$PSEUDO"
sleep 1
@ -56,6 +55,11 @@ espeak "video transcoding" #-acodec aac
rm -f ~/.zen/tmp/output.mp4
ffmpeg -i ~/.zen/tmp/MyVid.mp4 -vcodec libx264 -loglevel quiet ~/.zen/tmp/output.mp4
## Create short gif
rm -f ~/.zen/tmp/screen.gif
ffmpeg -ss 1.0 -t 4.0 -i ~/.zen/tmp/output.mp4 ~/.zen/tmp/screen.gif
# Conversion HLS
ffmpeg -i ~/.zen/tmp/output.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls ~/.zen/tmp/output.m3u8
IPFSID=$(ipfs add -wrHq ~/.zen/tmp/output.mp4 | tail -n 1)
@ -74,7 +78,7 @@ else
sed s/_IPFSID_/$IPFSID/g ${MY_PATH}/../templates/video_first.html > /tmp/index.html
fi
sed -i s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g /tmp/index.html
sed s/_PSEUDO_/$PLAYER/g /tmp/index.html > ~/.zen/game/players/.current/vlog/index.html
sed "s~_PSEUDO_~$PLAYER~g" /tmp/index.html > ~/.zen/game/players/.current/vlog/index.html
# Copy style & js
cp -R ${MY_PATH}/../templates/styles ~/.zen/game/players/.current/vlog/
@ -89,46 +93,68 @@ IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/.current/vlog | tail -n 1)
echo "NEW VIDEO http://127.0.0.1:8080/ipfs/$IPFSROOT"
## OUVERTURE VLOG CHAIN
xdg-open "http://127.0.0.1:8080/ipfs/$IPFSROOT"
# xdg-open "http://127.0.0.1:8080/ipfs/$IPFSROOT"
## AJOUT VIDEO ASTROPORT
MEDIAID="$(date -u +%s%N | cut -b1-13)"
MEDIAID=$(date -u +"%Y%m%d%H%M%S%4N")
mkdir -p ~/astroport/video/vlog/
MEDIAKEY="VLOG_${PLAYER}_${MEDIAID}"
cp ~/.zen/tmp/output.mp4 ~/astroport/video/vlog/$PLAYER_$MEDIAID.mp4
ANIMH=$(ipfs add -q ~/.zen/tmp/screen.gif)
REAL=$(file --mime-type "$HOME/astroport/video/vlog/$PLAYER_$MEDIAID.mp4" | cut -d ':' -f 2 | cut -d ' ' -f 2)
IPFSID=$(ipfs add -q ~/astroport/video/vlog/$PLAYER_$MEDIAID.mp4)
TEXT="<video controls><source src='/ipfs/"${IPFSID}"' type='"${REAL}"'></video><h1>"${PLAYER}"</h1>"
## TW not displaying direct ipfs
MIME="text/vnd.tiddlywiki"
TAGS="astroport $PLAYER vlog"
## TW not displaying direct ipfs video link (only image, pdf, ...) so insert <video> html tag
TEXT="<video controls preload='none' poster='/ipfs/"${ANIMH}"'><source src='/ipfs/"${IPFSID}"' type='"${REAL}"'></video><h1>"${PSEUDO}" / VLOG / "${MEDIAID}"</h1><br>http://127.0.0.1:8080/ipfs/$IPFSROOT"
echo "## Creation json tiddler"
echo '[
{
"text": "'${TEXT}'",
"title": "'${TITLE}'",
"type": "'${MIME}'",
"mime": "'${REAL}'",
"cat": "'${CAT}'",
"screenshot": "'${SCREENDIR}/screen.png'",
"ipfsroot": "'${IPFSREPFILEID}'",
"file": "'${file}'",
"title": "'VLOG ${MEDIAID}'",
"type": "'text/vnd.tiddlywiki'",
"mediakey": "'${MEDIAKEY}'",
"ipns": "'${IPNS}'",
"tmdb": "'${REFERENCE}'",
"tags": "'${TAGS}'" ' > ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
[[ ${CANON} != "" ]] && echo ',
"_canonical_uri": "'${CANON}'"' >> ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
echo '
"tags": "'${PSEUDO} vlog webcam ipfs video'"
}
]
' >> ~/astroport/${TYPE}/${REFERENCE}/${MEDIAKEY}.dragdrop.json
' > ~/.zen/game/players/.current/vlog/${MEDIAKEY}.dragdrop.json
# LOG
cat ~/.zen/game/players/.current/vlog/${MEDIAKEY}.dragdrop.json | jq
## Adding tiddler to PLAYER TW
ASTRONAUTENS=$(ipfs key list -l | grep -w "${PLAYER}" | cut -d ' ' -f 1)
rm -f ~/.zen/tmp/newindex.html
echo "Nouveau Qr$PEPPER dans MOA $PSEUDO : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
tiddlywiki --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
--import ~/.zen/game/players/.current/vlog/${MEDIAKEY}.dragdrop.json "application/json" \
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
echo "PLAYER TW Update..."
if [[ -s ~/.zen/tmp/newindex.html ]]; then
echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
echo "Avancement blockchain TW $PLAYER : $MOATS"
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.old
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
ipfs name publish --key=$PLAYER /ipfs/$TW
# MAJ CACHE TW $PLAYER
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
echo
else
echo "Une erreur est survenue lors de l'ajout du tiddler VLOG à votre TW"
fi
echo "$PSEUDO TW : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
# ~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/video/${MEDIAID}/" "output.mp4" "$G1PUB"