-
Notifications
You must be signed in to change notification settings - Fork 1
/
RTbolidozor.py
executable file
·63 lines (53 loc) · 1.49 KB
/
RTbolidozor.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# sudo apt-get install python-websocket
#
import sys
import time
#import urllib2
import requests
from mlabutils import ejson
exitapp = False
met = False
metData = ""
midiTime = 0
def main():
arg = sys.argv
if len(arg) != 2:
print("Usage: dataUpload [radio-observer configFile]")
sys.exit(1)
else:
configFile = arg[1]
parser = ejson.Parser()
config = parser.parse_file(configFile)
station = config["configurations"][0]["children"][0]["origin"]
observatory = config["storage_username"]
payload = {'station': station,
'observatory': observatory, 'msg': 'Hello!'}
print(payload)
r = requests.get('http://rtbolidozor.astro.cz/event',
params=payload, timeout=1)
# print(station)
# print(observatory)
while True:
try:
pipe = sys.stdin.readline()
if "met" in pipe:
print(("Meteor from radio-observer pipe:", pipe))
payload = {'station': station,
'observatory': observatory, 'msg': ''}
print(payload)
r = requests.get(
'http://rtbolidozor.astro.cz/event', params=payload, timeout=1)
else:
time.sleep(0.5)
except Exception as e:
print(e)
time.sleep(1)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
exitapp = True
raise 0