-
Notifications
You must be signed in to change notification settings - Fork 0
/
slideshow.py
48 lines (37 loc) · 1.07 KB
/
slideshow.py
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
# # Mustafa Kaptan
# # Slideshow program
import sys, ConfigParser, time
from SimpleCV import Image
from SimpleCV import ImageSet
from SimpleCV import Display
def main():
# Get file name
if len(sys.argv) < 2:
print "<%s> usage : <%s> <directory name>" %(sys.argv[0], sys.argv[0])
sys.exit()
else:
filename = sys.argv[1]
config = ConfigParser.RawConfigParser()
try:
config.readfp(open("./experiments/" + filename + "/config.ini"))
except IOError:
print "Error: can\'t find file or read data"
sys.exit()
# Display
display = Display()
# Set of slide images
slideSet = ImageSet("./experiments/" + filename)
lineList = config.items('sequence')
length = len(lineList)
sleepList = list()
# Sleep times
for line in lineList:
sleepList.append(int(line[1])/1000)
# Main loop
while display.isNotDone():
for index, img in enumerate(slideSet):
img.show()
time.sleep(sleepList[index])
sys.exit()
if __name__ == "__main__":
main()