Browse Source

hopefully works

master
trav 8 months ago
parent
commit
4afac32590
  1. 7
      carousel.py
  2. 10
      refreshdb.py
  3. 2
      run-ssb.sh

7
carousel.py

@ -57,14 +57,14 @@ newFlier = db.get(doc_id=dbIndex)
flierPath = newFlier["path"]
Limage = Image.new('1', (epd4in2.EPD_HEIGHT, epd4in2.EPD_WIDTH), 255) # 255: clear the frame
try:
font36 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 36)
font18 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 36)
epd = epd4in2.EPD()
epd.init()
bmp = Image.open(flierPath)
Limage.paste(bmp)
draw = ImageDraw.Draw(Limage)
draw.text((2, 240), 'EBB', font = font18, fill = 255)
draw.text((2, 260), 'version .02', font = font18, fill = 255)
draw.text((2, 280), 'EBB', font = font18, fill = 255)
draw.text((2, 300), 'version .02', font = font18, fill = 255)
epd.display(epd.getbuffer(Limage))
time.sleep(2)
epd.sleep()
@ -105,6 +105,7 @@ def button_e(button, pressed):
buttonshim.set_pixel(0x00, 0x00, 0xFF)
button_flag = "button_5"
buttonshim.set_pixel(0x00, 0x00, 0x00)
## MAIN LOOP ##
while True:

10
refreshdb.py

@ -21,6 +21,7 @@ def main():
def fresh():
print 'refreshing db from ssb'
#get our ssb pub key and db location from config
configParser = ConfigParser.RawConfigParser()
configFilePath = r'config.txt'
@ -33,11 +34,12 @@ def fresh():
#get time of last db-to-ssb sync from db
root_entry = db.get(doc_id=1)
last_run = root_entry["date"]
print 'looking for posts since: ' last_run
#if last run is never ran then only look back 1 month (new installs don't need EVERY old post...)
if last_run==4:
whatever=time.time()
whaever-=2700000
whatever-=2700000
last_run=int(whatever)
newssb="nada"
@ -89,11 +91,11 @@ def fresh():
except:
print 'traceback.format_exc():\n%s' % traceback.format_exc()
exit()
#tru/false:
#tru/false whether we have the blob:
newssb=proc.stdout.read()
print 'do we have the blob? ' newssb
print newssb
# if we have it, add it!
if (str(newssb)=='true\n'):
print "yep, we have the blob"
#generate unique file_name

2
run-ssb.sh

@ -1,6 +1,6 @@
#!/bin/bash
while true; do
ssb-server start
ssb-server start -- --friends.hops 1
sleep 300
done

Loading…
Cancel
Save