Raw code. Tested with PiZero in G1FabLab
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
mkdir -p "./IPFS/"
|
||||
mkdir -p "./SCAN/"
|
||||
|
||||
tail -fn 1 /tmp/qrcode.scan | while read -r line
|
||||
do
|
||||
QRCODE=$(echo $line | cut -d ' ' -f 1)
|
||||
MEMBER=$(echo $line | cut -d ' ' -f 2)
|
||||
if [[ "${QRCODE: 0:2}" == "Qm" ]]; then
|
||||
echo "IPFS! ${QRCODE}"
|
||||
mkdir -p "./IPFS/${QRCODE}"
|
||||
# GET PIN FROM NUMBOARD
|
||||
P1=$(python matrixKeypad_RPi_GPIO.py)
|
||||
P2=$(python matrixKeypad_RPi_GPIO.py)
|
||||
P3=$(python matrixKeypad_RPi_GPIO.py)
|
||||
P4=$(python matrixKeypad_RPi_GPIO.py)
|
||||
|
||||
PIN=$P1$P2$P3$P4
|
||||
|
||||
# GET CARD ON IPFS
|
||||
|
||||
ipfs cat ${QRCODE}/key.gpg > "./IPFS/${QRCODE}/key.pgp"
|
||||
echo $PIN | gpg --passphrase-fd 0 "./IPFS/${QRCODE}/key.pgp"
|
||||
|
||||
ipfs cat ${QRCODE}/authfile.gpg > "./IPFS/${QRCODE}/authfile.pgp"
|
||||
cat "./IPFS/${QRCODE}/key" | gpg --passphrase-fd 0 "./IPFS/${QRCODE}/authfile.pgp"
|
||||
|
||||
else
|
||||
|
||||
mkdir -p "./SCAN/${QRCODE}"
|
||||
curl https://g1pod.madeinzion.org/user/profile/${QRCODE} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "./SCAN/${QRCODE}/avatar.png"
|
||||
convert "./SCAN/${QRCODE}/avatar.png" -rotate 90 "./tmp/rotate.png"
|
||||
composite -compose Over -gravity East "./tmp/rotate.png" "./G1.png" "./tmp/avatar.png"
|
||||
|
||||
convert -font 'Times-Bold' \
|
||||
-pointsize 20 -fill black -draw 'text 10,20 "'"$MEMBER"'"' \
|
||||
"./tmp/avatar.png" "./tmp/uid.png"
|
||||
|
||||
convert "./tmp/uid.png" -strip +dither -colors 3 -treedepth 3 +remap "./result.png"
|
||||
|
||||
python inky_display.py
|
||||
|
||||
fi
|
||||
|
||||
done
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
################################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
|
||||
curl https://g1.duniter.org/wot/members > "./members.json"
|
||||
total=$(cat "./members.json" | jq '.results' | jq length)
|
||||
|
||||
|
||||
# Forever Loop
|
||||
while :
|
||||
do
|
||||
|
||||
member=$((RANDOM % $total))
|
||||
|
||||
uid=$(cat "./members.json" | jq ".results[$member].uid" | sed s/\"//g)
|
||||
pubkey=$(cat "./members.json" | jq ".results[$member].pubkey" | sed s/\"//g)
|
||||
test=$(curl https://g1pod.madeinzion.org/user/profile/${pubkey} | jq '._source.avatar._content')
|
||||
if [[ $test != null ]]; then
|
||||
echo "$pubkey $uid" >> /tmp/qrcode.scan
|
||||
sleep 45
|
||||
fi
|
||||
sleep 5
|
||||
done
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/python3
|
||||
################################################################################
|
||||
# Authors: Fred (support@qo-op.com) + Mark
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
################################################################################
|
||||
import cv2
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
import numpy as np
|
||||
from pyzbar import pyzbar
|
||||
|
||||
print("\n [INFO] STARTING VIDEO CAPTURE \n")
|
||||
faceCascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml')
|
||||
|
||||
cap = cv2.VideoCapture(0)
|
||||
|
||||
while 1:
|
||||
ret, img = cap.read()
|
||||
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||
time.sleep(1)
|
||||
# find the barcodes in the image and decode each of the barcodes
|
||||
barcodes = pyzbar.decode(img)
|
||||
# loop over the detected barcodes
|
||||
for barcode in barcodes:
|
||||
(x, y, w, h) = barcode.rect
|
||||
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 0, 255), 2)
|
||||
barcodeData = barcode.data.decode("utf-8")
|
||||
barcodeType = barcode.type
|
||||
text = "{} ({})".format(barcodeData, barcodeType)
|
||||
print("QRcode: %s"%(text))
|
||||
|
||||
# Filename to append
|
||||
filename = "/tmp/qrcode.scan"
|
||||
myfile = open(filename, 'a')
|
||||
myfile.write("%s\n"%(text))
|
||||
myfile.close()
|
||||
|
||||
# do a bit of cleanup
|
||||
print("\n [INFO] Exiting Program and cleanup stuff \n")
|
||||
cap.release()
|
||||
cv2.destroyAllWindows()
|
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1 @@
|
|||
樣e
|
|
@ -0,0 +1 @@
|
|||
樣e
|
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 58 KiB |
|
@ -0,0 +1 @@
|
|||
樣e
|
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 6.6 KiB |
|
@ -0,0 +1 @@
|
|||
樣e
|
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 98 KiB |
|
@ -0,0 +1 @@
|
|||
樣e
|
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 29 KiB |
|
@ -0,0 +1 @@
|
|||
樣e
|
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1 @@
|
|||
樣e
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 10 KiB |