#!/usr/bin/env python
"""A QND CGI to display something on the dashboard LED panel."""

import cgi
import cgitb

cgitb.enable(logdir='/tmp')

print 'Content-Type: text/html'

led_vars = {
	'height': 11,
	'width': 54
}

simple_example = """
<ul>
<!-- Horizontal # of LEDs -->
<li>%(height)s</li>
<!-- Vertical # of LEDs -->
<li>%(width)s</li>
<!-- LED states bit field -->
<li>
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
</li>
	<!-- Next URL to load -->
	<li>http://darkstar.frop.org/~zwhite/led_panel.cgi</li>
	<!-- Time until refresh in milliseconds, 0 means do not refresh. -->
	<li>5000</li>
	<!-- URL to load if an LED is clicked -->
	<li>http://darkstar.frop.org/~zwhite/led_panel.cgi</li>
	<!-- URL to open in browser window -->
	<li></li>
</ul>
"""

scrolling_message = """
<ul>
	<li>%(height)s</li>
	<li>%(width)s</li>
	<li></li>
	<li>led:marquee %(width)s 50 "I am the very model of a cartoon individual"</li>
	<li>5000</li>
	<li>http://darkstar.frop.org/~zwhite/led_panel.cgi</li>
	<li></li>
</ul>
"""

print scrolling_message % led_vars
