works and almost ready for PRIME TIME
This commit is contained in:
parent
79ffecc4b9
commit
424e9c1272
233
carousel.py
233
carousel.py
@ -68,7 +68,6 @@ try:
|
|||||||
# draw.text((2, 280), 'EBB', font = font18, fill = 255)
|
# draw.text((2, 280), 'EBB', font = font18, fill = 255)
|
||||||
draw.text((2, 300), 'Scuttlebooth 2', font = font18, fill = 255)
|
draw.text((2, 300), 'Scuttlebooth 2', font = font18, fill = 255)
|
||||||
epd.display(epd.getbuffer(Limage))
|
epd.display(epd.getbuffer(Limage))
|
||||||
time.sleep(2)
|
|
||||||
epd.sleep()
|
epd.sleep()
|
||||||
except:
|
except:
|
||||||
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
@ -78,21 +77,21 @@ except:
|
|||||||
@buttonshim.on_press(buttonshim.BUTTON_A)
|
@buttonshim.on_press(buttonshim.BUTTON_A)
|
||||||
def button_a(button, pressed):
|
def button_a(button, pressed):
|
||||||
global button_flag
|
global button_flag
|
||||||
buttonshim.set_pixel(0xFF, 0x00, 0x00)
|
# buttonshim.set_pixel(0xFF, 0x00, 0x00)
|
||||||
button_flag = "button_1"
|
button_flag = "button_1"
|
||||||
|
|
||||||
|
|
||||||
@buttonshim.on_press(buttonshim.BUTTON_B)
|
@buttonshim.on_press(buttonshim.BUTTON_B)
|
||||||
def button_b(button, pressed):
|
def button_b(button, pressed):
|
||||||
global button_flag
|
global button_flag
|
||||||
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
# buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
button_flag = "button_2"
|
button_flag = "button_2"
|
||||||
|
|
||||||
|
|
||||||
@buttonshim.on_press(buttonshim.BUTTON_C)
|
@buttonshim.on_press(buttonshim.BUTTON_C)
|
||||||
def button_c(button, pressed):
|
def button_c(button, pressed):
|
||||||
global button_flag
|
global button_flag
|
||||||
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
# buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
button_flag = "button_3"
|
button_flag = "button_3"
|
||||||
|
|
||||||
@buttonshim.on_press(buttonshim.BUTTON_D)
|
@buttonshim.on_press(buttonshim.BUTTON_D)
|
||||||
@ -131,12 +130,38 @@ def get_concat_h_blank(im1, im2, color=(0, 0, 0)):
|
|||||||
dst.paste(im2, (im1.width, 0))
|
dst.paste(im2, (im1.width, 0))
|
||||||
return dst
|
return dst
|
||||||
|
|
||||||
|
def pulse(speed):
|
||||||
|
time.sleep(1)
|
||||||
|
for scale in range(0, speed):
|
||||||
|
if scale >= 1:
|
||||||
|
scale = scale / speed
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, int(0xff * scale))
|
||||||
|
for scale in range(speed, 0,-1):
|
||||||
|
if scale >= 1:
|
||||||
|
scale = scale / speed
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, int(0xff * scale))
|
||||||
|
time.sleep(1)
|
||||||
|
for scale in range(0, speed):
|
||||||
|
if scale >= 1:
|
||||||
|
scale = scale / speed
|
||||||
|
buttonshim.set_pixel(0x00, int(0xff * scale), 0x00)
|
||||||
|
for scale in range(speed, 0,-1):
|
||||||
|
if scale >= 1:
|
||||||
|
scale = scale / 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)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
## MAIN LOOP ##
|
## MAIN LOOP ##
|
||||||
while True:
|
while True:
|
||||||
# chill for a bit, keep track of how long we're chilling
|
|
||||||
time.sleep(2)
|
|
||||||
print("time:", timeIndex, "/", intervalTime, "index", dbIndex, "/", dbCount, "sync time:", syncIndex, "/", syncTime)
|
|
||||||
|
|
||||||
#iterate through syncTime and image time
|
#iterate through syncTime and image time
|
||||||
syncIndex+=2
|
syncIndex+=2
|
||||||
timeIndex+=2
|
timeIndex+=2
|
||||||
@ -145,10 +170,11 @@ while True:
|
|||||||
if syncIndex >= syncTime:
|
if syncIndex >= syncTime:
|
||||||
#light up red while syncing db
|
#light up red while syncing db
|
||||||
buttonshim.set_pixel(0xFF, 0x00, 0x00)
|
buttonshim.set_pixel(0xFF, 0x00, 0x00)
|
||||||
refreshdb.fresh()
|
# refreshdb.fresh()
|
||||||
|
print ("uhhhhhhh skipping ssb refresh because broken also solpunk one stuck in customs rn :'(")
|
||||||
#db count may have changed
|
#db count may have changed
|
||||||
for item in db:
|
# for item in db:
|
||||||
dbCount = item.doc_id
|
# dbCount = item.doc_id
|
||||||
syncIndex = 0
|
syncIndex = 0
|
||||||
buttonshim.set_pixel(0x00, 0x00, 0x00)
|
buttonshim.set_pixel(0x00, 0x00, 0x00)
|
||||||
|
|
||||||
@ -182,7 +208,6 @@ while True:
|
|||||||
bmp = Image.open(flierPath)
|
bmp = Image.open(flierPath)
|
||||||
Limage.paste(bmp)
|
Limage.paste(bmp)
|
||||||
epd.display(epd.getbuffer(Limage))
|
epd.display(epd.getbuffer(Limage))
|
||||||
time.sleep(2)
|
|
||||||
timeIndex+=2
|
timeIndex+=2
|
||||||
epd.sleep()
|
epd.sleep()
|
||||||
|
|
||||||
@ -220,30 +245,40 @@ while True:
|
|||||||
|
|
||||||
|
|
||||||
#take fullsize photos
|
#take fullsize photos
|
||||||
|
pulse(20)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath1, '-vf', '-hf', '-w', '600', '-h', '800', '-t', '1000'])
|
result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath1, '--brightness', '55', '--contrast', '1.25','-vf', '-hf', '-w', '600', '-h', '800', '-t', '20'])
|
||||||
except:
|
except:
|
||||||
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
pulse(20)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath2, '-vf', '-hf', '-w', '600', '-h', '800', '-t', '1000'])
|
result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath2, '--brightness', '55', '--contrast', '1.25','-vf', '-hf', '-w', '600', '-h', '800', '-t', '20'])
|
||||||
except:
|
except:
|
||||||
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
pulse(20)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath3, '-vf', '-hf', '-w', '600', '-h', '800', '-t', '1000'])
|
result = subprocess.call(['raspistill', '-rot', '180', '-o', jpgpath3, '--brightness', '55', '--contrast', '1.25', '-vf', '-hf', '-w', '600', '-h', '800', '-t', '20'])
|
||||||
except:
|
except:
|
||||||
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xff)
|
||||||
|
|
||||||
#create half-size bmps for cycling through
|
#create half-size bmps for cycling through
|
||||||
half1 = Image.open(jpgpath1)
|
half1 = Image.open(jpgpath1)
|
||||||
half2 = Image.open(jpgpath2)
|
half2 = Image.open(jpgpath2)
|
||||||
half3 = Image.open(jpgpath3)
|
half3 = Image.open(jpgpath3)
|
||||||
newsize = (300, 400)
|
newsize = (300, 400)
|
||||||
half1 = half1.resize(newsize)
|
half1 = half1.resize(newsize)
|
||||||
half2 = half1.resize(newsize)
|
half2 = half2.resize(newsize)
|
||||||
half3 = half1.resize(newsize)
|
half3 = half3.resize(newsize)
|
||||||
half1 = half1.convert("1")
|
half1 = half1.convert("1")
|
||||||
half1.save(bmpath1)
|
half1.save(bmpath1)
|
||||||
half2 = half2.convert("1")
|
half2 = half2.convert("1")
|
||||||
@ -331,12 +366,6 @@ while True:
|
|||||||
if button_flag == "button_1":
|
if button_flag == "button_1":
|
||||||
button_flag == "null"
|
button_flag == "null"
|
||||||
|
|
||||||
|
|
||||||
#add each photo to the db
|
|
||||||
addtoDB.addToDB(bmpath1,dbPath,composite)
|
|
||||||
addtoDB.addToDB(bmpath2,dbPath,composite)
|
|
||||||
addtoDB.addToDB(bmpath3,dbPath,composite)
|
|
||||||
|
|
||||||
#add the photo strip to ssb
|
#add the photo strip to ssb
|
||||||
key = addtoDB.addToSSB(composite,dbPath,0)
|
key = addtoDB.addToSSB(composite,dbPath,0)
|
||||||
|
|
||||||
@ -346,7 +375,7 @@ while True:
|
|||||||
qr = qrcode.QRCode(
|
qr = qrcode.QRCode(
|
||||||
version = 1,
|
version = 1,
|
||||||
error_correction = qrcode.constants.ERROR_CORRECT_H,
|
error_correction = qrcode.constants.ERROR_CORRECT_H,
|
||||||
box_size = 5,
|
box_size = 6,
|
||||||
border = 1,
|
border = 1,
|
||||||
)
|
)
|
||||||
# Add data
|
# Add data
|
||||||
@ -359,13 +388,13 @@ while True:
|
|||||||
|
|
||||||
|
|
||||||
# generate full composite for printing
|
# generate full composite for printing
|
||||||
color=(0, 0, 0)
|
color=(255, 255, 255)
|
||||||
dst = Image.new('RGB', (600, 2890))
|
dst = Image.new('RGB', (600, 2833), color)
|
||||||
dst.paste(concaz, (0, 0))
|
dst.paste(concaz, (0, 0))
|
||||||
whereQRinstructionsAre = imagesPath + 'ssbqrinstgurct.jpg'
|
whereQRinstructionsAre = imagesPath + 'ssbqrinstgurct.jpg'
|
||||||
qrInstruct = Image.open(whereQRinstructionsAre)
|
qrInstruct = Image.open(whereQRinstructionsAre)
|
||||||
dst.paste(qrInstruct, (0,2675))
|
dst.paste(qrInstruct, (0,2575))
|
||||||
dst.paste(img, (385,2657))
|
dst.paste(img, (342,2575))
|
||||||
# whereInstructionsPlusQRis = imagesPath + 'instructionsPlusQR.jpg'
|
# whereInstructionsPlusQRis = imagesPath + 'instructionsPlusQR.jpg'
|
||||||
# get_concat_h_blank(qrInstruct, img, (255, 255, 255)).save(whereInstructionsPlusQRis)
|
# get_concat_h_blank(qrInstruct, img, (255, 255, 255)).save(whereInstructionsPlusQRis)
|
||||||
# instr = Image.open(whereInstructionsPlusQRis)
|
# instr = Image.open(whereInstructionsPlusQRis)
|
||||||
@ -377,6 +406,12 @@ while True:
|
|||||||
# save the full composite image for printing
|
# save the full composite image for printing
|
||||||
dst.save(FULLcomposite)
|
dst.save(FULLcomposite)
|
||||||
|
|
||||||
|
#add each photo to the db
|
||||||
|
addtoDB.addToDB(bmpath1,dbPath,FULLcomposite)
|
||||||
|
addtoDB.addToDB(bmpath2,dbPath,FULLcomposite)
|
||||||
|
addtoDB.addToDB(bmpath3,dbPath,FULLcomposite)
|
||||||
|
|
||||||
|
|
||||||
# concatenate existing composite image with the instructions+QR composite for full composite image for print
|
# concatenate existing composite image with the instructions+QR composite for full composite image for print
|
||||||
# get_concat_v(concaz, instr).save(FULLcomposite)
|
# get_concat_v(concaz, instr).save(FULLcomposite)
|
||||||
|
|
||||||
@ -388,8 +423,6 @@ while True:
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#update dbCount
|
#update dbCount
|
||||||
for item in db:
|
for item in db:
|
||||||
dbCount = item.doc_id
|
dbCount = item.doc_id
|
||||||
@ -406,19 +439,29 @@ while True:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#post only locally and print
|
#post only locally and print
|
||||||
if button_flag == "button_2":
|
if button_flag == "button_2":
|
||||||
|
#led to thinking mode
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
button_flag == "null"
|
button_flag == "null"
|
||||||
#add that file to the db. -1 tells addtoDB not to post to ssb.
|
|
||||||
addtoDB.addFile(bmpath,dbPath,-1)
|
|
||||||
|
#add each photo to the db
|
||||||
|
addtoDB.addToDB(bmpath1,dbPath,composite)
|
||||||
|
addtoDB.addToDB(bmpath2,dbPath,composite)
|
||||||
|
addtoDB.addToDB(bmpath3,dbPath,composite)
|
||||||
|
|
||||||
#update dbCount
|
#update dbCount
|
||||||
for item in db:
|
for item in db:
|
||||||
dbCount = item.doc_id
|
dbCount = item.doc_id
|
||||||
|
|
||||||
|
# print concaz that we already generated
|
||||||
|
try:
|
||||||
|
result = subprocess.call('lp ' + composite, shell=True)
|
||||||
|
except:
|
||||||
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
|
exit()
|
||||||
|
|
||||||
exitPhotoMode = True
|
exitPhotoMode = True
|
||||||
#display the image to clear the menu (also display text "posted")
|
#display the image to clear the menu (also display text "posted")
|
||||||
font18 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 24)
|
font18 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 24)
|
||||||
@ -429,26 +472,53 @@ while True:
|
|||||||
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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#just print
|
#just print
|
||||||
if button_flag == "button_3":
|
if button_flag == "button_3":
|
||||||
|
#led to thinking mode
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
button_flag == "null"
|
button_flag == "null"
|
||||||
#nothin! loop around... exitPhotoMode still false
|
|
||||||
|
# print concaz that we already generated
|
||||||
|
try:
|
||||||
|
result = subprocess.call('lp ' + composite, shell=True)
|
||||||
|
except:
|
||||||
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
|
exit()
|
||||||
|
|
||||||
|
exitPhotoMode = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#reshoot
|
#reshoot
|
||||||
if (button_flag == "button_4"):
|
if (button_flag == "button_4"):
|
||||||
|
# delete images
|
||||||
|
os.remove(bmpath1)
|
||||||
|
os.remove(bmpath2)
|
||||||
|
os.remove(bmpath3)
|
||||||
|
os.remove(jpgpath1)
|
||||||
|
os.remove(jpgpath2)
|
||||||
|
os.remove(jpgpath3)
|
||||||
|
# reset buttonflag and loop around to take pic again
|
||||||
button_flag == "null"
|
button_flag == "null"
|
||||||
exitPhotoMode = True
|
|
||||||
os.remove(bmpath)
|
|
||||||
os.remove(jpgpath)
|
|
||||||
|
|
||||||
#exit photo mode
|
#delete images and exit photo mode
|
||||||
if (button_flag == "button_5"):
|
if (button_flag == "button_5"):
|
||||||
button_flag == "null"
|
button_flag == "null"
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xff)
|
||||||
exitPhotoMode = True
|
exitPhotoMode = True
|
||||||
os.remove(bmpath)
|
#delete the images we took
|
||||||
os.remove(jpgpath)
|
os.remove(bmpath1)
|
||||||
|
os.remove(bmpath2)
|
||||||
|
os.remove(bmpath3)
|
||||||
|
os.remove(jpgpath1)
|
||||||
|
os.remove(jpgpath2)
|
||||||
|
os.remove(jpgpath3)
|
||||||
|
# display next image
|
||||||
|
timeIndex = intervalTime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#led off
|
#led off
|
||||||
@ -462,6 +532,7 @@ while True:
|
|||||||
|
|
||||||
#move to the next image
|
#move to the next image
|
||||||
elif button_flag == "button_2":
|
elif button_flag == "button_2":
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
print ("next image")
|
print ("next image")
|
||||||
timeIndex = intervalTime
|
timeIndex = intervalTime
|
||||||
button_flag = "null"
|
button_flag = "null"
|
||||||
@ -469,6 +540,7 @@ while True:
|
|||||||
|
|
||||||
#go back to the previous image
|
#go back to the previous image
|
||||||
elif button_flag == "button_3":
|
elif button_flag == "button_3":
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
print ("previous image")
|
print ("previous image")
|
||||||
#we go back 2 because we have to account for calling timeIndex = intervalTime iterates forward by 1
|
#we go back 2 because we have to account for calling timeIndex = intervalTime iterates forward by 1
|
||||||
dbIndex-=2
|
dbIndex-=2
|
||||||
@ -479,7 +551,8 @@ while True:
|
|||||||
|
|
||||||
|
|
||||||
#delete current image
|
#delete current image
|
||||||
elif button_flag == "button_4":
|
elif button_flag == "button_5":
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
button_flag = "null"
|
button_flag = "null"
|
||||||
|
|
||||||
#can't delete the default image
|
#can't delete the default image
|
||||||
@ -493,7 +566,7 @@ while True:
|
|||||||
draw.text((2, 0), 'Are you sure', font = font18, fill = 255)
|
draw.text((2, 0), 'Are you sure', font = font18, fill = 255)
|
||||||
draw.text((2, 40), 'you want to delete', font = font18, fill = 255)
|
draw.text((2, 40), 'you want to delete', font = font18, fill = 255)
|
||||||
draw.text((2, 80), 'the current image?', font = font18, fill = 255)
|
draw.text((2, 80), 'the current image?', font = font18, fill = 255)
|
||||||
draw.text((2, 120), 'Press button 4', font = font18, fill = 255)
|
draw.text((2, 120), 'Press button 5', font = font18, fill = 255)
|
||||||
draw.text((2, 160), 'again to confirm.', font = font18, fill = 255)
|
draw.text((2, 160), 'again to confirm.', font = font18, fill = 255)
|
||||||
draw.text((2, 200), 'Press any other', font = font18, fill = 255)
|
draw.text((2, 200), 'Press any other', font = font18, fill = 255)
|
||||||
draw.text((2, 240), 'button for no.', font = font18, fill = 255)
|
draw.text((2, 240), 'button for no.', font = font18, fill = 255)
|
||||||
@ -508,7 +581,7 @@ while True:
|
|||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
#sounds like delete time
|
#sounds like delete time
|
||||||
if button_flag == "button_4":
|
if button_flag == "button_5":
|
||||||
Fruit = Query()
|
Fruit = Query()
|
||||||
#results = db.search(Fruit.path == flierPath)
|
#results = db.search(Fruit.path == flierPath)
|
||||||
db.remove(Fruit.path == flierPath)
|
db.remove(Fruit.path == flierPath)
|
||||||
@ -525,37 +598,39 @@ while True:
|
|||||||
button_flag = "null"
|
button_flag = "null"
|
||||||
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
|
|
||||||
#weather button!
|
#reprint current set of pics
|
||||||
elif button_flag == "button_5":
|
elif button_flag == "button_4":
|
||||||
|
|
||||||
#ACTUALLY PARSE THE JSON DUH, THIS IS BROKEN
|
|
||||||
|
|
||||||
#get the weather
|
|
||||||
#proc = subprocess.Popen(["wget", "http://wttr.in/btv_FnQT.png"], stdout=subprocess.PIPE)
|
|
||||||
proc = subprocess.Popen(["wget", "http://wttr.in/btv_FQT.png"], stdout=subprocess.PIPE)
|
|
||||||
(out, err) = proc.communicate()
|
|
||||||
|
|
||||||
#convert
|
|
||||||
size = 400, 300
|
|
||||||
#too pixely
|
|
||||||
#im = Image.open("btv_FnQT.png")
|
|
||||||
#im = im.rotate(90, Image.NEAREST, "expand=1")
|
|
||||||
|
|
||||||
#sideways, no rotate
|
|
||||||
im = Image.open("btv_FQT.png")
|
|
||||||
|
|
||||||
im.thumbnail(size, Image.BICUBIC)
|
|
||||||
im = im.convert("1")
|
|
||||||
im.save("btv.bmp")
|
|
||||||
|
|
||||||
#display the weather
|
|
||||||
epd.init()
|
|
||||||
Limage = Image.new('1', (epd4in2.EPD_HEIGHT, epd4in2.EPD_WIDTH), 255) # 255: clear the frame
|
|
||||||
bmp = Image.open("btv.bmp")
|
|
||||||
Limage.paste(bmp)
|
|
||||||
epd.display(epd.getbuffer(Limage))
|
|
||||||
time.sleep(3)
|
|
||||||
timeIndex+=2
|
|
||||||
epd.sleep()
|
|
||||||
button_flag = "null"
|
button_flag = "null"
|
||||||
|
print ("button flag set to null...")
|
||||||
|
buttonshim.set_pixel(0x00, 0x00, 0xFF)
|
||||||
|
|
||||||
|
#grab the entry at dbIndex, newFlier is a dict
|
||||||
|
print ("getting db at")
|
||||||
|
print (dbIndex)
|
||||||
|
newFlier = db.get(doc_id=dbIndex)
|
||||||
|
|
||||||
|
#if that's an empty spot in the db we gotta keep lookin (probably wouldn't be in this case buuut whatever, this prevents errors)
|
||||||
|
while newFlier == None:
|
||||||
|
dbIndex+=1
|
||||||
|
newFlier = db.get(doc_id=dbIndex)
|
||||||
|
|
||||||
|
# get composite from db
|
||||||
|
flierPath = newFlier["composite"]
|
||||||
|
|
||||||
|
if flierPath == None:
|
||||||
|
print ("no flier here...")
|
||||||
|
|
||||||
|
# print composite
|
||||||
|
try:
|
||||||
|
result = subprocess.call('lp ' + flierPath, shell=True)
|
||||||
|
print ("printing...")
|
||||||
|
except:
|
||||||
|
print('traceback.format_exc():\n%s' % traceback.format_exc())
|
||||||
|
exit()
|
||||||
|
|
||||||
buttonshim.set_pixel(0x00, 0x00, 0x00)
|
buttonshim.set_pixel(0x00, 0x00, 0x00)
|
||||||
|
button_flag = "null"
|
||||||
|
|
||||||
|
# chill for a bit, keep track of how long we're chilling
|
||||||
|
time.sleep(2)
|
||||||
|
print("time:", timeIndex, "/", intervalTime, "index", dbIndex, "/", dbCount, "sync time:", syncIndex, "/", syncTime)
|
||||||
|
@ -10,4 +10,4 @@ blobID=$(cat $1 | ssb-server blobs.add)
|
|||||||
#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 "" --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.bmp --mentions.0.type image/bmp
|
||||||
|
Loading…
Reference in New Issue
Block a user