major rewrite
This commit is contained in:
44
main.py
44
main.py
@@ -5,11 +5,11 @@ import logging,coloredlogs
|
||||
from radar import TWCRadarCollector
|
||||
import os
|
||||
from datetime import datetime
|
||||
import RecordTasks
|
||||
import recordTasks
|
||||
|
||||
# Open the config file and make it accessible via "cfg"
|
||||
import json
|
||||
with open("conf.json", "r") as file:
|
||||
with open("config.json", "r") as file:
|
||||
cfg = json.load(file)
|
||||
|
||||
l = logging.getLogger(__name__)
|
||||
@@ -19,7 +19,7 @@ useRadarServer = cfg["useRadarServer"]
|
||||
|
||||
async def createTemp():
|
||||
""" Used on a first time run, creates necessary files & directories for the message encoder to work properly. """
|
||||
if not (os.path.exists('./.temp/')):
|
||||
if not (os.path.exists('./.temp')):
|
||||
l.info("Creating necessary directories & files..")
|
||||
os.mkdir('./.temp')
|
||||
|
||||
@@ -33,9 +33,9 @@ async def createTemp():
|
||||
os.mkdir('./.temp/output/satrad')
|
||||
|
||||
# Create msgId file for bit.py
|
||||
async with aiofiles.open('./.temp/msgId.txt', 'w') as msgId:
|
||||
await msgId.write('410080515')
|
||||
await msgId.close()
|
||||
#async with aiofiles.open('./.temp/msgId.txt', 'w') as msgId:
|
||||
#await msgId.write('694203')
|
||||
#await msgId.close()
|
||||
else:
|
||||
l.debug(".temp file exists")
|
||||
return
|
||||
@@ -44,21 +44,21 @@ async def createTemp():
|
||||
async def main():
|
||||
await createTemp()
|
||||
|
||||
mosaicTask = asyncio.create_task(RecordTasks.updateMosaicTask())
|
||||
satradTask = asyncio.create_task(RecordTasks.updateSatradTask())
|
||||
alertsTask = asyncio.create_task(RecordTasks.alertsTask())
|
||||
coTask = asyncio.create_task(RecordTasks.coTask())
|
||||
hfTask = asyncio.create_task(RecordTasks.hfTask())
|
||||
dfTask = asyncio.create_task(RecordTasks.dfTask())
|
||||
aqTask = asyncio.create_task(RecordTasks.aqTask())
|
||||
aptTask = asyncio.create_task(RecordTasks.aptTask())
|
||||
apTask = asyncio.create_task(RecordTasks.apTask())
|
||||
brTask = asyncio.create_task(RecordTasks.brTask())
|
||||
hcTask = asyncio.create_task(RecordTasks.hcTask())
|
||||
maTask = asyncio.create_task(RecordTasks.maTask())
|
||||
pTask = asyncio.create_task(RecordTasks.pTask())
|
||||
tTask = asyncio.create_task(RecordTasks.tTask())
|
||||
wnTask = asyncio.create_task(RecordTasks.wnTask())
|
||||
mosaicTask = asyncio.create_task(recordTasks.updateMosaicTask())
|
||||
satradTask = asyncio.create_task(recordTasks.updateSatradTask())
|
||||
alertsTask = asyncio.create_task(recordTasks.alertsTask())
|
||||
coTask = asyncio.create_task(recordTasks.coTask())
|
||||
hfTask = asyncio.create_task(recordTasks.hfTask())
|
||||
dfTask = asyncio.create_task(recordTasks.dfTask())
|
||||
aqTask = asyncio.create_task(recordTasks.aqTask())
|
||||
aptTask = asyncio.create_task(recordTasks.aptTask())
|
||||
apTask = asyncio.create_task(recordTasks.apTask())
|
||||
brTask = asyncio.create_task(recordTasks.brTask())
|
||||
hcTask = asyncio.create_task(recordTasks.hcTask())
|
||||
maTask = asyncio.create_task(recordTasks.maTask())
|
||||
pTask = asyncio.create_task(recordTasks.pTask())
|
||||
tTask = asyncio.create_task(recordTasks.tTask())
|
||||
wnTask = asyncio.create_task(recordTasks.wnTask())
|
||||
|
||||
# In theory, these should all run concurrently without problems
|
||||
await alertsTask
|
||||
@@ -80,4 +80,4 @@ async def main():
|
||||
await satradTask
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user