Mercurial > code > home > repos > light9
annotate bin/captureDevice @ 1998:3d28b1a54a29
reformat
Ignore-this: 28e00687983432a552e465291ef9b4b4
author | drewp@bigasterisk.com |
---|---|
date | Sun, 09 Jun 2019 21:56:03 +0000 |
parents | f29e26811206 |
children | 9aa046cc9b33 |
rev | line source |
---|---|
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 #!bin/python |
1859
f066d6e874db
2to3 with these fixers: all idioms set_literal
drewp@bigasterisk.com
parents:
1858
diff
changeset
|
2 |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
3 from rdflib import URIRef |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 from twisted.internet import reactor |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 from twisted.internet.defer import inlineCallbacks, Deferred |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 import logging |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 import optparse |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 import os |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 import time |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 import treq |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 import cyclone.web, cyclone.websocket, cyclone.httpclient |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 from greplin import scales |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 from run_local import log |
1861 | 16 from cycloneerr import PrettyErrorHandler |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 |
1585
17da56a3c8df
group device captures into sessions, limit solver to specific ones
Drew Perttula <drewp@bigasterisk.com>
parents:
1584
diff
changeset
|
18 from light9.namespaces import L9, RDF |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 from light9 import networking, showconfig |
1692 | 20 from rdfdb.syncedgraph import SyncedGraph |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
21 from light9.paint.capture import writeCaptureDescription |
1926
1a7e5b07bf17
use my greplin fork's stats/ code instead of an old local one
Drew Perttula <drewp@bigasterisk.com>
parents:
1866
diff
changeset
|
22 from greplin.scales.cyclonehandler import StatsHandler |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
23 from light9.effect.settings import DeviceSettings |
1830 | 24 from light9.collector.collector_client import sendToCollector |
1692 | 25 from rdfdb.patch import Patch |
1866
3c523c71da29
pyflakes cleanups and some refactors
Drew Perttula <drewp@bigasterisk.com>
parents:
1861
diff
changeset
|
26 from light9.zmqtransport import parseJsonMessage |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
27 |
1937
f29e26811206
pmfstats now update at 1hz. some ui improvements to stats lines.
Drew Perttula <drewp@bigasterisk.com>
parents:
1926
diff
changeset
|
28 stats = scales.collection('/webServer', scales.PmfStat('setAttr', |
f29e26811206
pmfstats now update at 1hz. some ui improvements to stats lines.
Drew Perttula <drewp@bigasterisk.com>
parents:
1926
diff
changeset
|
29 recalcPeriod=1)) |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
30 |
1858 | 31 |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
32 class Camera(object): |
1858 | 33 |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
34 def __init__(self, imageUrl): |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
35 self.imageUrl = imageUrl |
1858 | 36 |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
37 def takePic(self, uri, writePath): |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
38 log.info('takePic %s', uri) |
1858 | 39 return treq.get( |
40 self.imageUrl).addCallbacks(lambda r: self._done(writePath, r), | |
41 log.error) | |
42 | |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
43 @inlineCallbacks |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
44 def _done(self, writePath, response): |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
45 jpg = yield response.content() |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
46 try: |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
47 os.makedirs(os.path.dirname(writePath)) |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
48 except OSError: |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
49 pass |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
50 with open(writePath, 'w') as out: |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
51 out.write(jpg) |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
52 log.info('wrote %s', writePath) |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
53 |
1858 | 54 |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
55 def deferSleep(sec): |
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
56 d = Deferred() |
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
57 reactor.callLater(sec, d.callback, None) |
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
58 return d |
1858 | 59 |
60 | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
61 class Capture(object): |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
62 firstMoveTime = 3 |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
63 settleTime = .5 |
1858 | 64 |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
65 def __init__(self, graph, dev): |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
66 self.graph = graph |
1585
17da56a3c8df
group device captures into sessions, limit solver to specific ones
Drew Perttula <drewp@bigasterisk.com>
parents:
1584
diff
changeset
|
67 self.dev = dev |
1858 | 68 |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
69 def steps(a, b, n): |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
70 return [round(a + (b - a) * i / n, 5) for i in range(n)] |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
71 |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
72 startTime = time.time() |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
73 self.captureId = 'cap%s' % (int(startTime) - 1495170000) |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
74 self.toGather = [] |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
75 |
1625 | 76 #quantum |
77 rxSteps = steps(.06, .952, 10) | |
78 rySteps = steps(0.1, .77, 5) | |
79 zoomSteps = steps(.12, .85, 3) | |
80 # aura | |
81 rxSteps = steps(0.15, .95, 10) | |
82 rySteps = steps(0, .9, 5) | |
1858 | 83 zoomSteps = steps(.6, .9, 3) |
84 | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
85 row = 0 |
1625 | 86 for ry in rySteps: |
87 xSteps = rxSteps[:] | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
88 if row % 2: |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
89 xSteps.reverse() |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
90 row += 1 |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
91 for rx in xSteps: |
1625 | 92 for zoom in zoomSteps: |
1858 | 93 self.toGather.append( |
94 DeviceSettings( | |
95 graph, | |
96 [ | |
97 (dev, L9['rx'], rx), | |
98 (dev, L9['ry'], ry), | |
99 (dev, L9['color'], '#ffffff'), | |
100 (dev, L9['zoom'], zoom), | |
101 #(dev, L9['focus'], 0.13), | |
102 ])) | |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
103 |
1585
17da56a3c8df
group device captures into sessions, limit solver to specific ones
Drew Perttula <drewp@bigasterisk.com>
parents:
1584
diff
changeset
|
104 self.devTail = dev.rsplit('/')[-1] |
1858 | 105 self.session = URIRef('/'.join( |
106 [showconfig.showUri(), 'capture', self.devTail, self.captureId])) | |
1585
17da56a3c8df
group device captures into sessions, limit solver to specific ones
Drew Perttula <drewp@bigasterisk.com>
parents:
1584
diff
changeset
|
107 self.ctx = URIRef(self.session + '/index') |
1858 | 108 |
109 self.graph.patch( | |
110 Patch(addQuads=[ | |
111 (self.session, RDF.type, L9['CaptureSession'], self.ctx), | |
112 ])) | |
113 | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
114 self.numPics = 0 |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
115 self.settingsCache = set() |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
116 self.step().addErrback(log.error) |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
117 |
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
118 def off(self): |
1858 | 119 return sendToCollector(client='captureDevice', |
120 session='main', | |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
121 settings=DeviceSettings(self.graph, [])) |
1858 | 122 |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
123 @inlineCallbacks |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
124 def step(self): |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
125 if not self.toGather: |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
126 yield self.off() |
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
127 yield deferSleep(1) |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
128 reactor.stop() |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
129 return |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
130 settings = self.toGather.pop() |
1858 | 131 |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
132 log.info('[%s left] move to %r', len(self.toGather), settings) |
1858 | 133 yield sendToCollector(client='captureDevice', |
134 session='main', | |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
135 settings=settings) |
1858 | 136 |
137 yield deferSleep(self.firstMoveTime if self.numPics == | |
138 0 else self.settleTime) | |
139 | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
140 picId = 'pic%s' % self.numPics |
1858 | 141 path = '/'.join(['capture', self.devTail, self.captureId, picId |
142 ]) + '.jpg' | |
1585
17da56a3c8df
group device captures into sessions, limit solver to specific ones
Drew Perttula <drewp@bigasterisk.com>
parents:
1584
diff
changeset
|
143 uri = URIRef(self.session + '/' + picId) |
1858 | 144 |
1584
2239d5648932
captureDevice saves all pics
Drew Perttula <drewp@bigasterisk.com>
parents:
1553
diff
changeset
|
145 yield camera.takePic(uri, os.path.join(showconfig.root(), path)) |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
146 self.numPics += 1 |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
147 |
1585
17da56a3c8df
group device captures into sessions, limit solver to specific ones
Drew Perttula <drewp@bigasterisk.com>
parents:
1584
diff
changeset
|
148 writeCaptureDescription(self.graph, self.ctx, self.session, uri, |
1858 | 149 self.dev, path, self.settingsCache, settings) |
150 | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
151 reactor.callLater(0, self.step) |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
152 |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
153 |
1858 | 154 camera = Camera( |
155 'http://plus:8200/picamserve/pic?res=1080&resize=800&iso=800&redgain=1.6&bluegain=1.6&shutter=60000&x=0&w=1&y=0&h=.952' | |
156 ) | |
157 | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
158 |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
159 class Attrs(PrettyErrorHandler, cyclone.web.RequestHandler): |
1858 | 160 |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
161 def put(self): |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
162 with stats.setAttr.time(): |
1858 | 163 client, clientSession, settings, sendTime = parseJsonMessage( |
164 self.request.body) | |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
165 self.set_status(202) |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
166 |
1858 | 167 |
1552
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
168 def launch(graph): |
0aad247a1168
refactor and fix captureDevice
Drew Perttula <drewp@bigasterisk.com>
parents:
1544
diff
changeset
|
169 |
1625 | 170 cap = Capture(graph, dev=L9['device/aura5']) |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
171 reactor.listenTCP(networking.captureDevice.port, |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
172 cyclone.web.Application(handlers=[ |
1858 | 173 (r'/()', cyclone.web.StaticFileHandler, { |
174 "path": "light9/web", | |
175 "default_filename": "captureDevice.html" | |
176 }), | |
1926
1a7e5b07bf17
use my greplin fork's stats/ code instead of an old local one
Drew Perttula <drewp@bigasterisk.com>
parents:
1866
diff
changeset
|
177 (r'/stats/(.*)', StatsHandler, { |
1a7e5b07bf17
use my greplin fork's stats/ code instead of an old local one
Drew Perttula <drewp@bigasterisk.com>
parents:
1866
diff
changeset
|
178 'serverName': 'captureDevice' |
1a7e5b07bf17
use my greplin fork's stats/ code instead of an old local one
Drew Perttula <drewp@bigasterisk.com>
parents:
1866
diff
changeset
|
179 }), |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
180 ]), |
1866
3c523c71da29
pyflakes cleanups and some refactors
Drew Perttula <drewp@bigasterisk.com>
parents:
1861
diff
changeset
|
181 interface='::', |
3c523c71da29
pyflakes cleanups and some refactors
Drew Perttula <drewp@bigasterisk.com>
parents:
1861
diff
changeset
|
182 cap=cap) |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
183 log.info('serving http on %s', networking.captureDevice.port) |
1858 | 184 |
185 | |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
186 def main(): |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
187 parser = optparse.OptionParser() |
1858 | 188 parser.add_option("-v", |
189 "--verbose", | |
190 action="store_true", | |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
191 help="logging.DEBUG") |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
192 (options, args) = parser.parse_args() |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
193 log.setLevel(logging.DEBUG if options.verbose else logging.INFO) |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
194 |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
195 graph = SyncedGraph(networking.rdfdb.url, "captureDevice") |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
196 |
1858 | 197 graph.initiallySynced.addCallback(lambda _: launch(graph)).addErrback( |
198 log.error) | |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
199 reactor.run() |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
200 |
1858 | 201 |
1544
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
202 if __name__ == '__main__': |
fc5675f5b756
captureDevice tool for sweeping through light settings and grabbing pics
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
203 main() |