Mercurial > code > home > repos > light9
comparison bin/dmxserver @ 1860:5bcb950024af
reformat python
Ignore-this: 7bbe37d199612c9c74ef2904c3f13553
author | drewp@bigasterisk.com |
---|---|
date | Wed, 22 May 2019 00:09:13 +0000 |
parents | f066d6e874db |
children |
comparison
equal
deleted
inserted
replaced
1859:f066d6e874db | 1860:5bcb950024af |
---|---|
21 | 21 |
22 todo: | 22 todo: |
23 save dmx on quit and restore on restart | 23 save dmx on quit and restore on restart |
24 if parport fails, run in dummy mode (and make an option for that too) | 24 if parport fails, run in dummy mode (and make an option for that too) |
25 """ | 25 """ |
26 | |
27 | 26 |
28 from twisted.internet import reactor | 27 from twisted.internet import reactor |
29 from twisted.web import xmlrpc, server | 28 from twisted.web import xmlrpc, server |
30 import sys, time, os | 29 import sys, time, os |
31 from optparse import OptionParser | 30 from optparse import OptionParser |
125 cids = list(self.lastseen.keys()) | 124 cids = list(self.lastseen.keys()) |
126 for cid in cids: | 125 for cid in cids: |
127 lastseen = self.lastseen[cid] | 126 lastseen = self.lastseen[cid] |
128 if lastseen < now - purge_age: | 127 if lastseen < now - purge_age: |
129 print(("forgetting client %s (no activity for %s sec)" % | 128 print(("forgetting client %s (no activity for %s sec)" % |
130 (cid, purge_age))) | 129 (cid, purge_age))) |
131 try: | 130 try: |
132 del self.clientlevels[cid] | 131 del self.clientlevels[cid] |
133 except KeyError: | 132 except KeyError: |
134 pass | 133 pass |
135 del self.clientfreq[cid] | 134 del self.clientfreq[cid] |
182 x = max(x, cl) | 181 x = max(x, cl) |
183 self.combinedlevels.append(x) | 182 self.combinedlevels.append(x) |
184 | 183 |
185 def printlevels(self): | 184 def printlevels(self): |
186 """write all the levels to stdout""" | 185 """write all the levels to stdout""" |
187 print("Levels:", "".join( | 186 print("Levels:", |
188 ["% 2d " % (x * 100) for x in self.combinedlevels])) | 187 "".join(["% 2d " % (x * 100) for x in self.combinedlevels])) |
189 | 188 |
190 def printstats(self): | 189 def printstats(self): |
191 """print the clock, freq, etc, with a \r at the end""" | 190 """print the clock, freq, etc, with a \r at the end""" |
192 | 191 |
193 sys.stdout.write("dmxserver up at %s, [polls %s] " % ( | 192 sys.stdout.write("dmxserver up at %s, [polls %s] " % ( |