code at dwebcamp 2022, probably wont have more changes for a bit
This commit is contained in:
parent
424e9c1272
commit
b0b13a0769
28
carousel.py
28
carousel.py
@ -19,7 +19,7 @@ import configparser
|
|||||||
import pyqrcode
|
import pyqrcode
|
||||||
import qrcode
|
import qrcode
|
||||||
from tinydb import TinyDB, Query
|
from tinydb import TinyDB, Query
|
||||||
from PIL import Image,ImageDraw,ImageFont
|
from PIL import Image,ImageDraw,ImageFont,ImageEnhance
|
||||||
|
|
||||||
## INITIALIZE ##
|
## INITIALIZE ##
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ buttonshim.set_pixel(0xFF, 0x00, 0xFF)
|
|||||||
#intervalTime is how many seconds before moving to next image (300 = 5 minutes)
|
#intervalTime is how many seconds before moving to next image (300 = 5 minutes)
|
||||||
#sync time is how many seconds before refreshing the DB from SSB
|
#sync time is how many seconds before refreshing the DB from SSB
|
||||||
#this should be moved into the config file...
|
#this should be moved into the config file...
|
||||||
intervalTime = 1800
|
intervalTime = 200
|
||||||
syncTime = 3600
|
syncTime = 3600
|
||||||
#keep track of where we are moving through intervalTime, syncTime and where we are in the db, and what flier we're currently displaying
|
#keep track of where we are moving through intervalTime, syncTime and where we are in the db, and what flier we're currently displaying
|
||||||
timeIndex = 1200
|
timeIndex = 1200
|
||||||
@ -151,15 +151,19 @@ def pulse(speed):
|
|||||||
buttonshim.set_pixel(0x00, int(0xff * scale), 0x00)
|
buttonshim.set_pixel(0x00, int(0xff * scale), 0x00)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
for scale in range(0, speed):
|
for scale in range(0, speed):
|
||||||
if scale >= 1:
|
buttonshim.set_pixel(0xFF, 0x00, 0x00)
|
||||||
scale = scale / speed
|
time.sleep(.02)
|
||||||
buttonshim.set_pixel(int(0xff * scale), int(0xff * scale), 0x00)
|
buttonshim.set_pixel(0xFF, 0xFF, 0x00)
|
||||||
for scale in range(speed, 0,-1):
|
time.sleep(.02)
|
||||||
if scale >= 1:
|
buttonshim.set_pixel(0x00, 0xFF, 0x00)
|
||||||
scale = scale / speed
|
time.sleep(.02)
|
||||||
buttonshim.set_pixel(int(0xff * scale), int(0xff * scale), 0x00)
|
buttonshim.set_pixel(0xFF, 0xFF, 0x00)
|
||||||
|
time.sleep(.02)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## MAIN LOOP ##
|
## MAIN LOOP ##
|
||||||
while True:
|
while True:
|
||||||
#iterate through syncTime and image time
|
#iterate through syncTime and image time
|
||||||
@ -436,7 +440,8 @@ while True:
|
|||||||
draw.text((2, 240), 'photostrip posted', font = font18, fill = 255)
|
draw.text((2, 240), 'photostrip posted', font = font18, fill = 255)
|
||||||
draw.text((2, 260), 'to SSB', font = font18, fill = 255)
|
draw.text((2, 260), 'to SSB', font = font18, fill = 255)
|
||||||
epd.display(epd.getbuffer(Limage))
|
epd.display(epd.getbuffer(Limage))
|
||||||
|
# move dbIndex to current photo so that reprint works right
|
||||||
|
dbIndex = dbCount
|
||||||
|
|
||||||
|
|
||||||
#post only locally and print
|
#post only locally and print
|
||||||
@ -471,7 +476,8 @@ while True:
|
|||||||
draw.text((2, 240), 'PHOTO POSTED', font = font18, fill = 255)
|
draw.text((2, 240), 'PHOTO POSTED', font = font18, fill = 255)
|
||||||
draw.text((2, 260), 'to this device only', font = font18, fill = 255)
|
draw.text((2, 260), 'to this device only', font = font18, fill = 255)
|
||||||
epd.display(epd.getbuffer(Limage))
|
epd.display(epd.getbuffer(Limage))
|
||||||
|
# move dbIndex to current photo so that reprint works right
|
||||||
|
dbIndex = dbCount
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
19
ssbpost.sh
19
ssbpost.sh
@ -3,11 +3,26 @@
|
|||||||
#ok so this script should take an argument of an image and posts it
|
#ok so this script should take an argument of an image and posts it
|
||||||
|
|
||||||
#add blob
|
#add blob
|
||||||
blobID=$(cat $1 | ssb-server blobs.add)
|
blobID=$(cat $1 | ssb-server blobs.add) || exit 1
|
||||||
|
|
||||||
#echo $blobID
|
#echo $blobID
|
||||||
|
|
||||||
#publish blob
|
#publish blob
|
||||||
#key=$(ssb-server publish --type post --text "![upload.bmp($blobID)]"
|
#key=$(ssb-server publish --type post --text "![upload.bmp($blobID)]"
|
||||||
|
|
||||||
ssb-server publish --type post --text "a new photo from #dweb-camp 2022! " --mentions.0.name photo.bmp --mentions.0.type image/bmp
|
#ssb-server publish --type post --text "a new photo from #dweb-camp 2022! " --mentions.0.name photo.jpg --mentions.0.type image/bmp --mentions.0.link
|
||||||
|
|
||||||
|
ssb-server publish . <<EOF
|
||||||
|
{
|
||||||
|
"type":"post",
|
||||||
|
"text":"a new photo from #dweb-camp 2022! ",
|
||||||
|
"mentions": [
|
||||||
|
{
|
||||||
|
"name": "photo.jpg",
|
||||||
|
"type": "image/jpeg",
|
||||||
|
"link": "$blobID"
|
||||||
|
},
|
||||||
|
{"link":"#dweb-camp"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user