image

Just a link to the code that I wrote for loading the human calendar onto the lcdsysinfo screen that I brought on Ebay.

#!/usr/bin/env python

# Script to upload the human calendar to an lcdstatus screen
# Requires the python lcdstatus screen library at:
# https://github.com/dangardner/pylcdsysinfo
# Written by John Cooper 2013

#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

import requests
from ?BeautifulSoup import ?BeautifulSoup
#from PIL import Image
from StringIO import StringIO
import pylcdsysinfo
from pylcdsysinfo import LCDSysInfo, ?TextAlignment, ?TextColours, large_image_indexes


r = requests.get("http://api.humancalendar.com/iframe.php?t=2x2&s=250")

page = BeautifulSoup( r.text)
img = page.findAll('img')
print img[0]['src']
r = requests.get(img[0]['src'])
calendar_image = pylcdsysinfo.Image.open(StringIO(r.content))
calendar_image = pylcdsysinfo.simpleimage_resize(calendar_image)
rawfile = pylcdsysinfo.image_to_raw(calendar_image)


d = LCDSysInfo()
#d.write_rawimage_to_flash(1, rawfile)
slot=1
d.write_rawimage_to_flash(large_image_indexes[slot], rawfile)
d.display_icon(0, large_image_indexes[slot])

Also available as Human Calendar code gist

blog comments powered by Disqus