From b0b13a076967434c9959bed06e976ce3e70530bb Mon Sep 17 00:00:00 2001 From: trav Date: Wed, 24 Aug 2022 18:34:56 -0400 Subject: [PATCH] code at dwebcamp 2022, probably wont have more changes for a bit --- carousel.py | 28 +++++++++++++++++----------- ssbpost.sh | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/carousel.py b/carousel.py index e2d59a2..ea26ffc 100755 --- a/carousel.py +++ b/carousel.py @@ -19,7 +19,7 @@ import configparser import pyqrcode import qrcode from tinydb import TinyDB, Query -from PIL import Image,ImageDraw,ImageFont +from PIL import Image,ImageDraw,ImageFont,ImageEnhance ## INITIALIZE ## @@ -29,7 +29,7 @@ buttonshim.set_pixel(0xFF, 0x00, 0xFF) #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 #this should be moved into the config file... -intervalTime = 1800 +intervalTime = 200 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 timeIndex = 1200 @@ -151,15 +151,19 @@ def pulse(speed): buttonshim.set_pixel(0x00, int(0xff * scale), 0x00) time.sleep(1) for scale in range(0, speed): - if scale >= 1: - scale = scale / speed - buttonshim.set_pixel(int(0xff * scale), int(0xff * scale), 0x00) - for scale in range(speed, 0,-1): - if scale >= 1: - scale = scale / speed - buttonshim.set_pixel(int(0xff * scale), int(0xff * scale), 0x00) + buttonshim.set_pixel(0xFF, 0x00, 0x00) + time.sleep(.02) + buttonshim.set_pixel(0xFF, 0xFF, 0x00) + time.sleep(.02) + buttonshim.set_pixel(0x00, 0xFF, 0x00) + time.sleep(.02) + buttonshim.set_pixel(0xFF, 0xFF, 0x00) + time.sleep(.02) time.sleep(1) + + + ## MAIN LOOP ## while True: #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, 260), 'to SSB', font = font18, fill = 255) epd.display(epd.getbuffer(Limage)) - + # move dbIndex to current photo so that reprint works right + dbIndex = dbCount #post only locally and print @@ -471,7 +476,8 @@ while True: draw.text((2, 240), 'PHOTO POSTED', font = font18, fill = 255) draw.text((2, 260), 'to this device only', font = font18, fill = 255) epd.display(epd.getbuffer(Limage)) - + # move dbIndex to current photo so that reprint works right + dbIndex = dbCount diff --git a/ssbpost.sh b/ssbpost.sh index 08c421c..43fb6f1 100755 --- a/ssbpost.sh +++ b/ssbpost.sh @@ -3,11 +3,26 @@ #ok so this script should take an argument of an image and posts it #add blob -blobID=$(cat $1 | ssb-server blobs.add) +blobID=$(cat $1 | ssb-server blobs.add) || exit 1 #echo $blobID #publish blob #key=$(ssb-server publish --type post --text "![upload.bmp($blobID)]" -ssb-server publish --type post --text "a new photo from #dweb-camp 2022! ![photo.bmp]($blobID)" --mentions.0.name photo.bmp --mentions.0.type image/bmp +#ssb-server publish --type post --text "a new photo from #dweb-camp 2022! ![photo.bmp]($blobID)" --mentions.0.name photo.jpg --mentions.0.type image/bmp --mentions.0.link + +ssb-server publish . <