-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpumpkin
executable file
·62 lines (56 loc) · 2.77 KB
/
pumpkin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python
from fc_lib import *
import signal
import os
import opc
import sys
import time
pid = str(os.getpid())
pidfile = "/var/run/pumpkin.pid"
if os.path.isfile(pidfile):
print "%s already exists, exiting" % pidfile
sys.exit()
else:
file(pidfile, 'w').write(pid)
def set_exit_handler(func):
signal.signal(signal.SIGTERM, func)
def on_exit(sig, func=None):
print "exit handler triggered"
sys.exit(1)
if __name__ == '__main__':
set_exit_handler(on_exit)
client = opc.Client('localhost:7890')
paths = ['/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-0.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-1.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-1.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-2.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-3.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-4.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-5.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-6.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-7.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-8.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-9.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-10.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-11.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-12.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-13.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-14.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-15.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-16.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-17.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-18.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-19.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-20.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-21.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-22.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-23.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-24.png',
'/home/pi/fadecandy_shenanigans/pumpkin_images/pumpkin-25.png']
images = [read_image_to_array(path) for path in paths]
images = images
while True:
for image in images:
client.put_pixels(image)
client.put_pixels(image)
time.sleep(0.11)