video chain + crypto.proto

This commit is contained in:
fred 2022-03-17 21:44:07 +01:00
parent e65ff48c30
commit 2d2c272168
8 changed files with 235 additions and 35 deletions

View File

@ -40,30 +40,38 @@ Longitude: 1.65397188
---
Amabassade pour Astronautes Terraformeurs.
Bienvenue dans la confédération intergalactique.
Ambassade des Astronautes Terraformeurs.
Avant de commencer l'aventure, découvrez cet ouvrage "The Barefoot Architect" de Johan Van Lengen.
```
ipfs ls Qme6a6RscGHTg4e1XsRrpRoNbfA6yojC6XNCBrS8nPSEox/
ipfs cat QmbfVUAyX6hsxTMAZY7MhvUmB3AkfLS7KqWihjGfu327yG /tmp/vdoc.pub_the-barefoot-architect.pdf
```
Le JEu est constitué de Stations IPFS localisés à des cooordonnées précises.
Ces stations acceuillent des joueurs. Leur mission, réaliser des rêves.
Dans IPFS, chacun publie son site web statique comportant texte, image, sons et vidéos (selon les modèles situés dans Templates)
Bienvenue dans la confédération intergalactique
DELARATION DES LIEUX
~/.zen/game/worlds
- Coord GPS - Map Minetest
- niveaux autonomie: eau, nourrture, chaleur, hygiène, esprit, ...
- expériences techniques + art des gens
- Coord GPS (Map Minetest)
- Certification des niveaux d'aptitudes à utiliser des outils ou équipements.
- Niveaux autonomies: eau, nourriture, couchages, electricité, chaleur, conservation, ...
- Ambassade & Enregistrement des joueurs ("VISA") : Passeport Terre.
- Collecte & publication des rêves : Pinterest
NAVIGATEUR JOUEUR
~/.zen/game/players
- savoir faire
- équipements
- moyens de transport
- Identité astronaute + VISA
- aptitudes / équipements
- arbres informationnels, projection de rêves.
---

View File

@ -11,29 +11,16 @@
homefolder=$(pwd)
newgame="$HOME/.zen/game"
if [[ ! -d ~/.zen/game/rooms ]]; then
mkdir -p $newgame
cp -r rooms $newgame/rooms
cp -r art $newgame/art
cp -r script $newgame/script
cp -r logic $newgame/logic
cp -r tools $newgame/tools
cp start.sh $newgame/
fi
[[ -d "$HOME/.zen/worlds" ]] && echo "Ambassade active - Astroport ONE - Le Menu" && ./start.sh && echo && exit
echo "Chargement..."
echo
sleep 3
cd $newgame/rooms
cd "$homefolder/rooms"
./start.sh
cd "$homefolder"
rm -r $newgame
echo
exit

View File

@ -49,7 +49,7 @@ MAINTENANT INSTALLATION DES OUTILS NÉCESSAIRES ET DU MATÉRIEL CRYPTOGRAPHIQUE
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
sudo apt-get update
for i in git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev printer-driver-all cups figlet apt-transport-https ca-certificates; do
for i in git fail2ban inotify-tools curl net-tools libsodium* python3-dev python3-pip python3-setuptools python3-wheel python3-dotenv mpack libssl-dev libffi-dev printer-driver-all cups figlet apt-transport-https ca-certificates protobuf-compiler; do
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
sudo apt install -y $i
fi

View File

@ -2,9 +2,9 @@
<html>
<head>
<title>_PSEUDO_ VIDEO BLOG - Astroport One</title>
<link rel="stylesheet" href="./styles/decoration.css" type="text/css" />
<link rel="stylesheet" href="./styles/layout.css" type="text/css" />
<link rel="icon" type="image/png" href="./styles/logo.png" />
<link rel="stylesheet" href="/ipfs/_IPFSROOT_/styles/decoration.css" type="text/css" />
<link rel="stylesheet" href="/ipfs/_IPFSROOT_/styles/layout.css" type="text/css" />
<link rel="icon" type="image/png" href="/ipfs/_IPFSROOT_/styles/logo.png" />
</head>
<body>

View File

@ -2,9 +2,9 @@
<html>
<head>
<title>_PSEUDO_ VIDEO BLOG - Astroport One</title>
<link rel="stylesheet" href="./styles/decoration.css" type="text/css" />
<link rel="stylesheet" href="./styles/layout.css" type="text/css" />
<link rel="icon" type="image/png" href="./styles/logo.png" />
<link rel="stylesheet" href="/ipfs/_IPFSROOT_/styles/decoration.css" type="text/css" />
<link rel="stylesheet" href="/ipfs/_IPFSROOT_/styles/layout.css" type="text/css" />
<link rel="icon" type="image/png" href="/ipfs/_IPFSROOT_/styles/logo.png" />
</head>
<body>

22
tools/crypto.proto Normal file
View File

@ -0,0 +1,22 @@
syntax = "proto2";
package crypto.pb;
option go_package = "github.com/libp2p/go-libp2p-core/crypto/pb";
enum KeyType {
RSA = 0;
Ed25519 = 1;
Secp256k1 = 2;
ECDSA = 3;
}
message PublicKey {
required KeyType Type = 1;
required bytes Data = 2;
}
message PrivateKey {
required KeyType Type = 1;
required bytes Data = 2;
}

162
tools/crypto_pb2.py Normal file
View File

@ -0,0 +1,162 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: crypto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='crypto.proto',
package='crypto.pb',
syntax='proto2',
serialized_options=_b('Z*github.com/libp2p/go-libp2p-core/crypto/pb'),
serialized_pb=_b('\n\x0c\x63rypto.proto\x12\tcrypto.pb\";\n\tPublicKey\x12 \n\x04Type\x18\x01 \x02(\x0e\x32\x12.crypto.pb.KeyType\x12\x0c\n\x04\x44\x61ta\x18\x02 \x02(\x0c\"<\n\nPrivateKey\x12 \n\x04Type\x18\x01 \x02(\x0e\x32\x12.crypto.pb.KeyType\x12\x0c\n\x04\x44\x61ta\x18\x02 \x02(\x0c*9\n\x07KeyType\x12\x07\n\x03RSA\x10\x00\x12\x0b\n\x07\x45\x64\x32\x35\x35\x31\x39\x10\x01\x12\r\n\tSecp256k1\x10\x02\x12\t\n\x05\x45\x43\x44SA\x10\x03\x42,Z*github.com/libp2p/go-libp2p-core/crypto/pb')
)
_KEYTYPE = _descriptor.EnumDescriptor(
name='KeyType',
full_name='crypto.pb.KeyType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='RSA', index=0, number=0,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Ed25519', index=1, number=1,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Secp256k1', index=2, number=2,
serialized_options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ECDSA', index=3, number=3,
serialized_options=None,
type=None),
],
containing_type=None,
serialized_options=None,
serialized_start=150,
serialized_end=207,
)
_sym_db.RegisterEnumDescriptor(_KEYTYPE)
KeyType = enum_type_wrapper.EnumTypeWrapper(_KEYTYPE)
RSA = 0
Ed25519 = 1
Secp256k1 = 2
ECDSA = 3
_PUBLICKEY = _descriptor.Descriptor(
name='PublicKey',
full_name='crypto.pb.PublicKey',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='Type', full_name='crypto.pb.PublicKey.Type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='Data', full_name='crypto.pb.PublicKey.Data', index=1,
number=2, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=27,
serialized_end=86,
)
_PRIVATEKEY = _descriptor.Descriptor(
name='PrivateKey',
full_name='crypto.pb.PrivateKey',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='Type', full_name='crypto.pb.PrivateKey.Type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='Data', full_name='crypto.pb.PrivateKey.Data', index=1,
number=2, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=88,
serialized_end=148,
)
_PUBLICKEY.fields_by_name['Type'].enum_type = _KEYTYPE
_PRIVATEKEY.fields_by_name['Type'].enum_type = _KEYTYPE
DESCRIPTOR.message_types_by_name['PublicKey'] = _PUBLICKEY
DESCRIPTOR.message_types_by_name['PrivateKey'] = _PRIVATEKEY
DESCRIPTOR.enum_types_by_name['KeyType'] = _KEYTYPE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
PublicKey = _reflection.GeneratedProtocolMessageType('PublicKey', (_message.Message,), dict(
DESCRIPTOR = _PUBLICKEY,
__module__ = 'crypto_pb2'
# @@protoc_insertion_point(class_scope:crypto.pb.PublicKey)
))
_sym_db.RegisterMessage(PublicKey)
PrivateKey = _reflection.GeneratedProtocolMessageType('PrivateKey', (_message.Message,), dict(
DESCRIPTOR = _PRIVATEKEY,
__module__ = 'crypto_pb2'
# @@protoc_insertion_point(class_scope:crypto.pb.PrivateKey)
))
_sym_db.RegisterMessage(PrivateKey)
DESCRIPTOR._options = None
# @@protoc_insertion_point(module_scope)

View File

@ -9,11 +9,26 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
TS=$(date -u +%s%N | cut -b1-13)
screencapture(){
vlc \
-I dummy screen://\
--dummy-quiet \
--no-video :screen-fps=15 :screen-caching=300 \
--sout "#transcode{vcodec=h264,vb=800,fps=5,scale=1,acodec=none}:duplicate{dst=std{access=file,mux=mp4,dst='${HOME}/Screencapture $(date +%Y-%m-%d) at $(date +%H.%M.%S).mp4'}}"
deskid="$!"
}
if [[ -f ~/.zen/soundrecord.config ]]; then
source ~/.zen/soundrecord.config
else
RECDEVICE=$(pactl list short sources | grep input | cut -f 2)
fi
echo "Voulez-vous enregistrer le bureau? ENTER sinon"
read desktop
[[ $desktop != "" ]] && screencapture
espeak "Starting Video record. Press ENTER to stop."
# Find "input-slave" :: pactl list short sources
@ -31,6 +46,7 @@ kill -15 $processid
## RECOMMANCER ?
espeak "mp4 transcoding" #-acodec aac
# ffmpeg -i input.mp4 -i greenscreen.mp4 -filter_complex '[1:v]colorkey=color=00FF00:similarity=0.85:blend=0.0[ckout];[0:v][ckout]overlay[out]' -map '[out]' output.mp4
rm -f ~/.zen/tmp/output.mp4
ffmpeg -i ~/.zen/tmp/MyVid.mp4 -vcodec libx264 -loglevel quiet ~/.zen/tmp/output.mp4
IPFSID=$(ipfs add -wrHq ~/.zen/tmp/output.mp4 | tail -n 1)
@ -52,9 +68,14 @@ sed s/_PSEUDO_/$PSEUDO/g /tmp/index.html > ~/.zen/game/players/.current/public/i
# Copy style css
cp -R ${MY_PATH}/../templates/styles ~/.zen/game/players/.current/public/
INDEXID=$(ipfs add -rHq ~/.zen/game/players/.current/public | tail -n 1)
echo $INDEXID > ~/.zen/game/players/.current/.vlog.index
echo "LAST VIDEO INDEX http://127.0.0.1:8080/ipfs/$INDEXID"
IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/.current/public | tail -n 1)
echo $IPFSROOT > ~/.zen/game/players/.current/.vlog.index
# Change CSS path to
sed s/_IPFSROOT_/$IPFSROOT/g /tmp/index.html > ~/.zen/game/players/.current/public/index.html
IPFSROOT=$(ipfs add -rHq ~/.zen/game/players/.current/public | tail -n 1)
echo "NEW VIDEO http://127.0.0.1:8080/ipfs/$IPFSROOT"
# https://stackoverflow.com/questions/49846400/raspberry-pi-use-vlc-to-stream-webcam-logitech-c920-h264-video-without-tran