Merge pull request #2 from the5dcrew/needlen0se

Needlen0se
This commit is contained in:
April 2022-10-19 15:27:27 -07:00 committed by GitHub
commit 122b29486a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 8 deletions

View File

@ -1,12 +1,17 @@
import json import json
import sys
import xmltodict import xmltodict
# Open the MachineProductCfg.xml file in the root directory # Open the MachineProductCfg.xml file in the root directory
with open("MachineProductCfg.xml", mode = 'r', encoding= 'utf-8') as MPCxml: try:
MPCdict = xmltodict.parse(MPCxml.read()) with open("MachineProductCfg.xml", mode = 'r', encoding= 'utf-8') as MPCxml:
MPCdump = json.dumps(MPCdict) MPCdict = xmltodict.parse(MPCxml.read())
data = json.loads(MPCdump) MPCdump = json.dumps(MPCdict)
data = json.loads(MPCdump)
except Exception as e:
print(e)
sys.exit("There was an error opening your MachineProductCfg.xml. Is the file in the root folder?")
def getPrimaryLocations(): def getPrimaryLocations():

22
main.py
View File

@ -1,13 +1,29 @@
import asyncio import asyncio
from asyncio.log import logger
from asyncore import loop from asyncore import loop
import logging,coloredlogs import logging,coloredlogs
from recordGenerators import DailyForecast,CurrentObservations,HourlyForecast,AirQuality,AirportDelays,PollenForecast,Breathing,Alerts from recordGenerators import DailyForecast,CurrentObservations,HourlyForecast,AirQuality,AirportDelays,PollenForecast,Breathing,Alerts
# from radar import TWCRadarProcessor, RadarProcessor from radar import TWCRadarProcessor, RadarProcessor
import os
l = logging.getLogger(__name__) l = logging.getLogger(__name__)
coloredlogs.install(logger=l) coloredlogs.install(logger=l)
# Create dirs and files
if not os.path.exists('./.temp/'):
os.makedirs('./.temp/')
if not os.path.exists('./.temp/tiles/'):
os.makedirs('./.temp/tiles/')
if not os.path.exists('./.temp/tiles/output/'):
os.makedirs('./.temp/tiles/output/')
if not os.path.exists('./.temp/msgId.txt'):
print("Creating initial msgId file")
with open('./.temp/msgId.txt', "w") as f:
f.write("410080515")
""" """
CurrentConditions: Every 5 minutes CurrentConditions: Every 5 minutes
@ -15,7 +31,7 @@ Daily Forecasts, Hourlies, etc: 60 minutes
Alerts: 5 minutes Alerts: 5 minutes
""" """
l.info("Starting i2RecordCollector") l.info("Starting i2RecordCollector")
l.info("Developed by mewtek32, Floppaa, and Goldblaze") l.info("Developed by mewtek32, Floppaa, Goldblaze, and needlenose")
async def grabAlertsLoop(): async def grabAlertsLoop():
while True: while True: