2020-12-21 08:19:07 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import time
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
import config
|
|
|
|
from plugins import plugins
|
|
|
|
|
2020-12-21 13:25:20 +01:00
|
|
|
def emit(event, data):
|
|
|
|
json = {
|
|
|
|
"event": event,
|
|
|
|
"data": data
|
|
|
|
}
|
|
|
|
return requests.post(config.OSD_URL, json=json)
|
2020-12-21 08:19:07 +01:00
|
|
|
|
|
|
|
def main():
|
|
|
|
data = requests.get(config.CAR_API_URL)
|
|
|
|
for plugin in plugins:
|
2020-12-21 13:25:20 +01:00
|
|
|
plugin.check(data, emit)
|
2020-12-21 08:19:07 +01:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
while True:
|
|
|
|
main()
|
|
|
|
time.sleep(config.DELAY)
|