28 lines
666 B
Python
28 lines
666 B
Python
import sys
|
|
from streams import EventStream
|
|
from nicoscache import NicosStream
|
|
from secop import ScanStream, ScanReply, send_fake_udp
|
|
from influx import testdb
|
|
|
|
|
|
def main():
|
|
# egen = EventStream(ScanReply(), ScanStream(), n=NicosStream('localhost:14002'))
|
|
egen = EventStream(ScanReply(), ScanStream())
|
|
db = testdb()
|
|
db.enable_write_access()
|
|
try:
|
|
while 1:
|
|
for event in egen.get_events():
|
|
db.add_point(*event)
|
|
db.flush()
|
|
finally:
|
|
for event in egen.finish():
|
|
db.add_point(*event)
|
|
db.disconnect()
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
send_fake_udp(*sys.argv[1:])
|
|
else:
|
|
main()
|