mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-11 17:00:23 -05:00
Move data to temp directory
This commit is contained in:
parent
2fcf8a033e
commit
e8554e81ed
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@ tiles/*
|
|||||||
|
|
||||||
# Python compiled files
|
# Python compiled files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
||||||
|
.temp/
|
@ -30,13 +30,13 @@ def sendFile(files, commands, numSgmts, Pri):
|
|||||||
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
||||||
exit()
|
exit()
|
||||||
#Get the next message ID
|
#Get the next message ID
|
||||||
with open('C:\\Clips\\msgId.txt', "r") as f:
|
with open('./.temp/msgId.txt', "r") as f:
|
||||||
oMsgId = f.read()
|
oMsgId = f.read()
|
||||||
msgNum = int(oMsgId)
|
msgNum = int(oMsgId)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
nMsgNum = msgNum + 1
|
nMsgNum = msgNum + 1
|
||||||
h = open('C:\\Clips\\msgId.txt', "w")
|
h = open('./.temp/msgId.txt', "w")
|
||||||
h.write(str(nMsgNum))
|
h.write(str(nMsgNum))
|
||||||
h.close()
|
h.close()
|
||||||
segnmNum = 0
|
segnmNum = 0
|
||||||
@ -122,13 +122,13 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...")
|
||||||
exit()
|
exit()
|
||||||
#Get the next message ID
|
#Get the next message ID
|
||||||
with open('C:\\Clips\\msgId.txt', "r") as f:
|
with open('./.temp/msgId.txt', "r") as f:
|
||||||
oMsgId = f.read()
|
oMsgId = f.read()
|
||||||
msgNum = int(oMsgId)
|
msgNum = int(oMsgId)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
nMsgNum = msgNum + 1
|
nMsgNum = msgNum + 1
|
||||||
h = open('C:\\Clips\\msgId.txt', "w")
|
h = open('./.temp/msgId.txt', "w")
|
||||||
h.write(str(nMsgNum))
|
h.write(str(nMsgNum))
|
||||||
h.close()
|
h.close()
|
||||||
segnmNum = 0
|
segnmNum = 0
|
||||||
@ -140,15 +140,15 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
|
|
||||||
for x in command:
|
for x in command:
|
||||||
bx = bytes(x, 'utf-8')
|
bx = bytes(x, 'utf-8')
|
||||||
with open('D:\\command', 'wb') as c:
|
with open('./.temp/command', 'wb') as c:
|
||||||
c.write(bx)
|
c.write(bx)
|
||||||
c.close()
|
c.close()
|
||||||
size = os.path.getsize('D:\\command')
|
size = os.path.getsize('./.temp/command')
|
||||||
encode1 = bytes('I2MSG', 'UTF-8')
|
encode1 = bytes('I2MSG', 'UTF-8')
|
||||||
commandLength = size
|
commandLength = size
|
||||||
encode2 = commandLength.to_bytes(4, byteorder='little')
|
encode2 = commandLength.to_bytes(4, byteorder='little')
|
||||||
theCommand = b"".join([encode1, encode2])
|
theCommand = b"".join([encode1, encode2])
|
||||||
with open('D:\\command', 'ab') as d:
|
with open('./.temp/command', 'ab') as d:
|
||||||
d.write(theCommand)
|
d.write(theCommand)
|
||||||
d.close()
|
d.close()
|
||||||
check = size - BUF_SIZE
|
check = size - BUF_SIZE
|
||||||
@ -162,14 +162,14 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
pc = packet_count.to_bytes(4, byteorder='little')
|
pc = packet_count.to_bytes(4, byteorder='little')
|
||||||
i = 0
|
i = 0
|
||||||
char = ''
|
char = ''
|
||||||
new_size = os.path.getsize('D:\\command')
|
new_size = os.path.getsize('./.temp/command')
|
||||||
|
|
||||||
if startFlag == False:
|
if startFlag == False:
|
||||||
#Our 34 byte beginning packet
|
#Our 34 byte beginning packet
|
||||||
p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0)
|
p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0)
|
||||||
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
|
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
|
||||||
startFlag = True
|
startFlag = True
|
||||||
with open('D:\\Command',"rb") as message:
|
with open('./.temp/Command',"rb") as message:
|
||||||
message.seek(0)
|
message.seek(0)
|
||||||
data = message.read(BUF_SIZE)
|
data = message.read(BUF_SIZE)
|
||||||
while data:
|
while data:
|
||||||
@ -212,16 +212,16 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
|
|
||||||
|
|
||||||
#Send Current Observations
|
#Send Current Observations
|
||||||
#sendFile("C:\\Clips\\CurrentObservations.i2m.gz", '<MSG><Exec workRequest="storeData(File={0},QGROUP=__CurrentObservations__,Feed=CurrentObservations)" /><GzipCompressedMsg fname="CurrentObservations.i2m" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/CurrentObservations.i2m.gz", '<MSG><Exec workRequest="storeData(File={0},QGROUP=__CurrentObservations__,Feed=CurrentObservations)" /><GzipCompressedMsg fname="CurrentObservations.i2m" /></MSG>I2MSG', 0)
|
||||||
#time.sleep(10)
|
#time.sleep(10)
|
||||||
#Send Hourly Forecast
|
#Send Hourly Forecast
|
||||||
#sendFile("C:\\Clips\\HourlyForecast.i2m.gz", '<MSG><Exec workRequest="storeData(File={0},QGROUP=__HourlyForecast__,Feed=HourlyForecast)" /><GzipCompressedMsg fname="HourlyForecast.i2m" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/HourlyForecast.i2m.gz", '<MSG><Exec workRequest="storeData(File={0},QGROUP=__HourlyForecast__,Feed=HourlyForecast)" /><GzipCompressedMsg fname="HourlyForecast.i2m" /></MSG>I2MSG', 0)
|
||||||
#time.sleep(10)
|
#time.sleep(10)
|
||||||
#Send Daily Forecast
|
#Send Daily Forecast
|
||||||
#sendFile("C:\\Clips\\DailyForecast.i2m.gz", '<MSG><Exec workRequest="storeData(File={0},QGROUP=__DailyForecast__,Feed=DailyForecast)" /><GzipCompressedMsg fname="DailyForecast.i2m" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/DailyForecast.i2m.gz", '<MSG><Exec workRequest="storeData(File={0},QGROUP=__DailyForecast__,Feed=DailyForecast)" /><GzipCompressedMsg fname="DailyForecast.i2m" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#Send radar image
|
#Send radar image
|
||||||
#sendFile("C:\\Clips\\radar.i2m", '<MSG><Exec workRequest="storePriorityImage(File={0},FileExtension=.tiff,IssueTime=08/28/2022 03:00:00,Location=US,ImageType=Radar)" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/radar.i2m", '<MSG><Exec workRequest="storePriorityImage(File={0},FileExtension=.tiff,IssueTime=08/28/2022 03:00:00,Location=US,ImageType=Radar)" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#Load Local On The 8s
|
#Load Local On The 8s
|
||||||
#sendCommand('<MSG><Exec workRequest="loadPres(File={0},VideoBehind=000,Logo=domesticAds/tag3352,Flavor=domestic/V,Duration=1950,PresentationId=3E396FFF95A00067)" /></MSG>I2MSG', 1)
|
#sendCommand('<MSG><Exec workRequest="loadPres(File={0},VideoBehind=000,Logo=domesticAds/tag3352,Flavor=domestic/V,Duration=1950,PresentationId=3E396FFF95A00067)" /></MSG>I2MSG', 1)
|
||||||
@ -249,16 +249,16 @@ def sendCommand(command, Pri, msgNum = None):
|
|||||||
#sendCommand('<MSG><Exec workRequest="restartI2Service(File={0},CommandId=0000)" /><CheckHeadendId><HeadendId>040500</HeadendId></CheckHeadendId></MSG>I2MSG', 1)
|
#sendCommand('<MSG><Exec workRequest="restartI2Service(File={0},CommandId=0000)" /><CheckHeadendId><HeadendId>040500</HeadendId></CheckHeadendId></MSG>I2MSG', 1)
|
||||||
|
|
||||||
#Set ANF Mode
|
#Set ANF Mode
|
||||||
#sendFile("C:\\Clips\\ANFOn.i2m",'<MSG><Exec workRequest="setANFDisplay(File={0},CommandId=0000)" /><CheckHeadendId><HeadendId>040500</HeadendId><HeadendId>040449</HeadendId><HeadendId>030025</HeadendId></CheckHeadendId></MSG>I2MSG', 1)
|
#sendFile("./.temp/ANFOn.i2m",'<MSG><Exec workRequest="setANFDisplay(File={0},CommandId=0000)" /><CheckHeadendId><HeadendId>040500</HeadendId><HeadendId>040449</HeadendId><HeadendId>030025</HeadendId></CheckHeadendId></MSG>I2MSG', 1)
|
||||||
|
|
||||||
#SendBundle
|
#SendBundle
|
||||||
#sendFile("C:\\Clips\\Bundles.zip",'<MSG><Exec workRequest="stageStarBundle(File={0})" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/Bundles.zip",'<MSG><Exec workRequest="stageStarBundle(File={0})" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#Send Upgrade
|
#Send Upgrade
|
||||||
#sendFile("C:\\Clips\\Upgrades\\maintenance_1.0.0.50.zip",'<MSG><Exec workRequest="storeUpgrade(File={0},ReleaseName=maintenance_1.0.0.50)" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/Upgrades/maintenance_1.0.0.50.zip",'<MSG><Exec workRequest="storeUpgrade(File={0},ReleaseName=maintenance_1.0.0.50)" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#Stage Upgrade
|
#Stage Upgrade
|
||||||
#sendCommand('<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=maintenance_1.0.0.50)" /></MSG>I2MSG', 0)
|
#sendCommand('<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=maintenance_1.0.0.50)" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#Change Passwords
|
#Change Passwords
|
||||||
#sendFile("C:\\Clips\\passwords.i2m",'<MSG><Exec workRequest="changePassword(File={0},CommandId=0000)" /></MSG>I2MSG', 0)
|
#sendFile("./.temp/passwords.i2m",'<MSG><Exec workRequest="changePassword(File={0},CommandId=0000)" /></MSG>I2MSG', 0)
|
@ -129,7 +129,7 @@ def sendStarBundle(File):
|
|||||||
count = file_number - 1
|
count = file_number - 1
|
||||||
part = 1
|
part = 1
|
||||||
|
|
||||||
with open('C:\\Clips\\msgId.txt', "r") as f:
|
with open('./.temp/msgId.txt', "r") as f:
|
||||||
oMsgId = f.read()
|
oMsgId = f.read()
|
||||||
Id = int(oMsgId)
|
Id = int(oMsgId)
|
||||||
f.close()
|
f.close()
|
||||||
@ -186,7 +186,7 @@ def sendUpgrade(File, RelName):
|
|||||||
count = file_number - 1
|
count = file_number - 1
|
||||||
part = 1
|
part = 1
|
||||||
|
|
||||||
with open('C:\\Clips\\msgId.txt', "r") as f:
|
with open('./.temp/msgId.txt', "r") as f:
|
||||||
oMsgId = f.read()
|
oMsgId = f.read()
|
||||||
Id = int(oMsgId)
|
Id = int(oMsgId)
|
||||||
f.close()
|
f.close()
|
||||||
@ -213,7 +213,7 @@ def sendUpgrade(File, RelName):
|
|||||||
|
|
||||||
def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
||||||
header = '<StarBundle>\n <Version>' + Version + '</Version>\n <ApplyDate>' + date + '</ApplyDate>\n <Type>' + Type + '</Type>\n <FileActions>\n'
|
header = '<StarBundle>\n <Version>' + Version + '</Version>\n <ApplyDate>' + date + '</ApplyDate>\n <Type>' + Type + '</Type>\n <FileActions>\n'
|
||||||
with open('D:\\i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'w') as ma:
|
with open('./.temp/i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'w') as ma:
|
||||||
ma.write(header)
|
ma.write(header)
|
||||||
ma.close()
|
ma.close()
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
|||||||
rootDir = root[24:]
|
rootDir = root[24:]
|
||||||
bDest = os.path.join(rootDir,name)
|
bDest = os.path.join(rootDir,name)
|
||||||
fDest = os.path.join(root,name)
|
fDest = os.path.join(root,name)
|
||||||
shutil.copy(fDest, 'D:\\i2State\\SD\\ChangesetBundle')
|
shutil.copy(fDest, './.temp/i2State\\SD\\ChangesetBundle')
|
||||||
for name in files:
|
for name in files:
|
||||||
if flag == 'Domestic_Universe':
|
if flag == 'Domestic_Universe':
|
||||||
flag = 'flags="Domestic_Universe"'
|
flag = 'flags="Domestic_Universe"'
|
||||||
@ -230,11 +230,11 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
|||||||
flag = 'flags="Domestic_SD_Universe"'
|
flag = 'flags="Domestic_SD_Universe"'
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
with open('D:\\i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as mb:
|
with open('./.temp/i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as mb:
|
||||||
mb.write(' <Add src="' + name + '" dest="' + bDest + '" ' + flag + ' />\n')
|
mb.write(' <Add src="' + name + '" dest="' + bDest + '" ' + flag + ' />\n')
|
||||||
mb.close()
|
mb.close()
|
||||||
closer = ' </FileActions>\n</StarBundle>'
|
closer = ' </FileActions>\n</StarBundle>'
|
||||||
with open('D:\\i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as ma:
|
with open('./.temp/i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as ma:
|
||||||
ma.write(closer)
|
ma.write(closer)
|
||||||
ma.close()
|
ma.close()
|
||||||
|
|
||||||
@ -249,22 +249,22 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
|||||||
|
|
||||||
#loadRunPres(['038488'], 'domestic/ldlE', '', '72000', 'LDL1')
|
#loadRunPres(['038488'], 'domestic/ldlE', '', '72000', 'LDL1')
|
||||||
|
|
||||||
#changePasswords('C:\\Clips\\passwords2.gz', ['006833'])
|
#changePasswords('./.temp/passwords2.gz', ['006833'])
|
||||||
|
|
||||||
#sendMaintCommand('C:\\Clips\\maint\\temp\\passwords',['040500'])
|
#sendMaintCommand('./.temp/maint\\temp\\passwords',['040500'])
|
||||||
|
|
||||||
#sendStarBundle("C:\\Clips\\Bundle.zip")
|
#sendStarBundle("./.temp/Bundle.zip")
|
||||||
|
|
||||||
#sendUpgrade("C:\\Clips\\Upgrades\\wireshark_1.4.6.0.zip", "wireshark_1.4.6.0")
|
#sendUpgrade("./.temp/Upgrades\\wireshark_1.4.6.0.zip", "wireshark_1.4.6.0")
|
||||||
|
|
||||||
#For splitting
|
#For splitting
|
||||||
#sendUpgrade("C:\\Clips\\ChangesetHD.zip", "PipelineMaint_6.15.1.5714")
|
#sendUpgrade("./.temp/ChangesetHD.zip", "PipelineMaint_6.15.1.5714")
|
||||||
|
|
||||||
#For no split upgrades
|
#For no split upgrades
|
||||||
#bit.sendFile('C:\\Clips\\Upgrades\\vizRequiredFilesForI2_1.2.0.0.zip', '<MSG><Exec workRequest="storeUpgrade(File={0},ReleaseName=vlc_1.1.12.0)" /><CheckHeadendId><HeadendId>040500</HeadendId></CheckHeadendId></MSG>I2MSG', 0)
|
#bit.sendFile('./.temp/Upgrades\\vizRequiredFilesForI2_1.2.0.0.zip', '<MSG><Exec workRequest="storeUpgrade(File={0},ReleaseName=vlc_1.1.12.0)" /><CheckHeadendId><HeadendId>040500</HeadendId></CheckHeadendId></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#For split upgrades
|
#For split upgrades
|
||||||
#bit.sendFile('C:\\Clips\\split\\ChangesetHD_04', '<MSG><SplitMsg id="410059811" part="4" count="69" /></MSG>I2MSG', 0)
|
#bit.sendFile('./.temp/split\\ChangesetHD_04', '<MSG><SplitMsg id="410059811" part="4" count="69" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
#Command for split upgrades
|
#Command for split upgrades
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
|||||||
#commands.append(command)
|
#commands.append(command)
|
||||||
#bit.sendCommand(commands, 1, 0)
|
#bit.sendCommand(commands, 1, 0)
|
||||||
|
|
||||||
#bit.sendFile(['C:\\Clips\\Alert.gz'], ['<MSG><Exec workRequest="storePriorityData(File={0},QGROUP=__BEUrgent__,Feed=BEUrgent)" /><GzipCompressedMsg fname="Alert.i2m" /></MSG>'], 1, 0)
|
#bit.sendFile(['./.temp/Alert.gz'], ['<MSG><Exec workRequest="storePriorityData(File={0},QGROUP=__BEUrgent__,Feed=BEUrgent)" /><GzipCompressedMsg fname="Alert.i2m" /></MSG>'], 1, 0)
|
||||||
'''
|
'''
|
||||||
bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=7zip_9.20.0.0)" /></MSG>'], 0)
|
bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=7zip_9.20.0.0)" /></MSG>'], 0)
|
||||||
bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=agentRansack_2010.03.29.47911)" /></MSG>'], 0)
|
bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=agentRansack_2010.03.29.47911)" /></MSG>'], 0)
|
||||||
@ -292,7 +292,7 @@ bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediate
|
|||||||
bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=wireshark_1.4.6.0)" /></MSG>'], 0)
|
bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=wireshark_1.4.6.0)" /></MSG>'], 0)
|
||||||
'''
|
'''
|
||||||
#bit.sendCommand(['<MSG><Exec workRequest="cancelPres(File={0},PresentationId=LDL,StartTime=09/17/2022 02:32:40:00)" /><CheckHeadendId><HeadendId>006833</HeadendId></CheckHeadendId></MSG>'], 1)
|
#bit.sendCommand(['<MSG><Exec workRequest="cancelPres(File={0},PresentationId=LDL,StartTime=09/17/2022 02:32:40:00)" /><CheckHeadendId><HeadendId>006833</HeadendId></CheckHeadendId></MSG>'], 1)
|
||||||
#bit.sendCommand('C:\\Clips\\Upgrades\\split\\PipelineMaint_6.15.1.5714_03', '<MSG><Exec workRequest="storeUpgrade(File=C:/Program Files/TWC/i2/Volatile/MsgIngester-7787/410059604,ReleaseName=PipelineMaint_6.15.1.5714)" /></MSG>I2MSG', 0)
|
#bit.sendCommand('./.temp/Upgrades\\split\\PipelineMaint_6.15.1.5714_03', '<MSG><Exec workRequest="storeUpgrade(File=C:/Program Files/TWC/i2/Volatile/MsgIngester-7787/410059604,ReleaseName=PipelineMaint_6.15.1.5714)" /></MSG>I2MSG', 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -305,5 +305,5 @@ bit.sendCommand(['<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediate
|
|||||||
|
|
||||||
#bit.sendCommand(['<MSG><Exec workRequest="runPres(File={0},PresentationId=ldl,StartTime=09/17/2022 17:03:35:00)" /></MSG>'], 1)
|
#bit.sendCommand(['<MSG><Exec workRequest="runPres(File={0},PresentationId=ldl,StartTime=09/17/2022 17:03:35:00)" /></MSG>'], 1)
|
||||||
|
|
||||||
#makeStarBundle('D:\\i2State\\SD\\Changeset\\audio\\domesticSD\\vocalLocal\\Cantore', 'Changeset', 'Domestic_SD_Universe', '63702614401035937', '09/19/2022', 0)
|
#makeStarBundle('./.temp/i2State\\SD\\Changeset\\audio\\domesticSD\\vocalLocal\\Cantore', 'Changeset', 'Domestic_SD_Universe', '63702614401035937', '09/19/2022', 0)
|
||||||
|
|
||||||
|
@ -42,4 +42,4 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
|
|||||||
|
|
||||||
|
|
||||||
#Directory which contains Files to be bundled Type Flags Version Date SendImmediately(Does not apply to this script)
|
#Directory which contains Files to be bundled Type Flags Version Date SendImmediately(Does not apply to this script)
|
||||||
makeStarBundle('D:\\i2State\\SD\\Managed\\Events', 'Managed', 'Domestic_SD_Universe', '637898877227230030', '09/28/2022', 0)
|
makeStarBundle('./.temp/i2State/SD/Managed/Events', 'Managed', 'Domestic_SD_Universe', '637898877227230030', '09/28/2022', 0)
|
@ -38,7 +38,7 @@ def getData(epaId, zipcode):
|
|||||||
# Write to i2doc file
|
# Write to i2doc file
|
||||||
i2Doc = f'<AirQuality id="000000000" locationKey="{epaId}" isWxScan="0">' + '' + newData + f'<clientKey>{epaId}</clientKey></AirQuality>'
|
i2Doc = f'<AirQuality id="000000000" locationKey="{epaId}" isWxScan="0">' + '' + newData + f'<clientKey>{epaId}</clientKey></AirQuality>'
|
||||||
|
|
||||||
f = open("D:\\AirQuality.i2m", 'a')
|
f = open("./.temp/AirQuality.i2m", 'a')
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -62,29 +62,29 @@ def writeData():
|
|||||||
header = '<Data type="AirQuality">'
|
header = '<Data type="AirQuality">'
|
||||||
footer = "</Data>"
|
footer = "</Data>"
|
||||||
|
|
||||||
with open("D:\\AirQuality.i2m", 'w') as doc:
|
with open("./.temp/AirQuality.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for (x, y) in zip(workingEpaIds, zipCodes):
|
for (x, y) in zip(workingEpaIds, zipCodes):
|
||||||
getData(x, y)
|
getData(x, y)
|
||||||
|
|
||||||
with open("D:\\AirQuality.i2m", 'a') as end:
|
with open("./.temp/AirQuality.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\AirQuality.i2m")
|
dom = xml.dom.minidom.parse("./.temp/AirQuality.i2m")
|
||||||
xmlPretty = dom.toprettyxml(indent = " ")
|
xmlPretty = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\AirQuality.i2m", 'w') as g:
|
with open("./.temp/AirQuality.i2m", 'w') as g:
|
||||||
g.write(xmlPretty[23:])
|
g.write(xmlPretty[23:])
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
with open("D:\\AirQuality.i2m", 'rb') as f_in:
|
with open("./.temp/AirQuality.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\AirQuality.gz", 'wb') as f_out:
|
with gzip.open("./.temp/AirQuality.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\AirQuality.gz"
|
gZipFile = "./.temp/AirQuality.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
comand = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__AirQuality__,Feed=AirQuality)" /><GzipCompressedMsg fname="AirQuality" /></MSG>')
|
comand = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__AirQuality__,Feed=AirQuality)" /><GzipCompressedMsg fname="AirQuality" /></MSG>')
|
||||||
@ -92,8 +92,8 @@ def writeData():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\AirQuality.i2m")
|
os.remove("./.temp/AirQuality.i2m")
|
||||||
os.remove("D:\\AirQuality.gz")
|
os.remove("./.temp/AirQuality.gz")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
l.error("DO NOT REPORT THE ERROR BELOW")
|
l.error("DO NOT REPORT THE ERROR BELOW")
|
||||||
l.error("Failed to write an AirQuality record.")
|
l.error("Failed to write an AirQuality record.")
|
||||||
|
@ -40,7 +40,7 @@ def getData(airport):
|
|||||||
# Write to i2doc file
|
# Write to i2doc file
|
||||||
i2Doc = f'<AirportDelays id="000000000" locationKey="{airport}" isWxScan="0">' + '' + newData + f'<clientKey>{airport}</clientKey></AirportDelays>'
|
i2Doc = f'<AirportDelays id="000000000" locationKey="{airport}" isWxScan="0">' + '' + newData + f'<clientKey>{airport}</clientKey></AirportDelays>'
|
||||||
|
|
||||||
f = open("D:\\AirportDelays.i2m", 'a')
|
f = open("./.temp/AirportDelays.i2m", 'a')
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -64,29 +64,29 @@ def writeData():
|
|||||||
header = '<Data type="AirportDelays">'
|
header = '<Data type="AirportDelays">'
|
||||||
footer = "</Data>"
|
footer = "</Data>"
|
||||||
|
|
||||||
with open("D:\\AirportDelays.i2m", 'w') as doc:
|
with open("./.temp/AirportDelays.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for x in airportsWithDelays:
|
for x in airportsWithDelays:
|
||||||
getData(x)
|
getData(x)
|
||||||
|
|
||||||
with open("D:\\AirportDelays.i2m", 'a') as end:
|
with open("./.temp/AirportDelays.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\AirportDelays.i2m")
|
dom = xml.dom.minidom.parse("./.temp/AirportDelays.i2m")
|
||||||
prettyXml = dom.toprettyxml(indent=" ")
|
prettyXml = dom.toprettyxml(indent=" ")
|
||||||
|
|
||||||
with open("D:\\AirportDelays.i2m", 'w') as g:
|
with open("./.temp/AirportDelays.i2m", 'w') as g:
|
||||||
g.write(prettyXml)
|
g.write(prettyXml)
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
with open("D:\\AirportDelays.i2m", 'rb') as f_in:
|
with open("./.temp/AirportDelays.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\AirportDelays.gz", 'wb') as f_out:
|
with gzip.open("./.temp/AirportDelays.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\AirportDelays.gz"
|
gZipFile = "./.temp/AirportDelays.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
comand = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__AirportDelays__,Feed=AirportDelays)" /><GzipCompressedMsg fname="AirportDelays" /></MSG>')
|
comand = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__AirportDelays__,Feed=AirportDelays)" /><GzipCompressedMsg fname="AirportDelays" /></MSG>')
|
||||||
@ -94,7 +94,7 @@ def writeData():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\AirportDelays.i2m")
|
os.remove("./.temp/AirportDelays.i2m")
|
||||||
os.remove("D:\\AirportDelays.gz")
|
os.remove("./.temp/AirportDelays.gz")
|
||||||
else:
|
else:
|
||||||
l.info("No airport delays found.")
|
l.info("No airport delays found.")
|
||||||
|
@ -304,7 +304,7 @@ def getAlerts(location):
|
|||||||
alertMsg = '<BERecord id="0000" locationKey="' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + x['eventTrackingNumber'] + '_' + x['officeCode'] + '" isWxscan="0"><action>NOT_USED</action><BEHdr><bPIL>' + x['productIdentifier'] + '</bPIL><bWMOHdr>NOT_USED</bWMOHdr><bEvent><eActionCd eActionPriority="' + str(x['messageTypeCode']) + '">' + Action + '</eActionCd><eOfficeId eOfficeNm="' + x['officeName'] + '">' + x['officeCode'] + '</eOfficeId><ePhenom>' + x['phenomena'] + '</ePhenom><eSgnfcnc>' + x['significance'] + '</eSgnfcnc><eETN>' + x['eventTrackingNumber'] + '</eETN><eDesc>' + x['eventDescription'] + '</eDesc><eStTmUTC>NOT_USED</eStTmUTC><eEndTmUTC>' + EndTimeUTC + '</eEndTmUTC><eSvrty>' + str(x['severityCode']) + '</eSvrty><eTWCIId>NOT_USED</eTWCIId><eExpTmUTC>' + expireTimeUTC + '</eExpTmUTC></bEvent><bLocations><bLocCd bLoc="' + x['areaName'] + '" bLocTyp="' + locationType + '">' + location + '</bLocCd><bStCd bSt="' + x['adminDistrict'] + '">' + x['adminDistrictCode'] + '</bStCd><bUTCDiff>NOT_USED</bUTCDiff><bTzAbbrv>NOT_USED</bTzAbbrv><bCntryCd>NOT_USED</bCntryCd></bLocations><bSgmtChksum>' + x['identifier'] + '</bSgmtChksum><procTm>' + processTime + '</procTm></BEHdr><BEData><bIssueTmUTC>' + issueTimeUtc + '</bIssueTmUTC><bHdln><bHdlnTxt>' + x['headlineText'] + '</bHdlnTxt>' + vocalCode + '</bHdln><bParameter>NOT_USED</bParameter><bNarrTxt bNarrTxtLang="en-US"><bLn>' + description + '</bLn></bNarrTxt><bSrchRslt>NOT_USED</bSrchRslt></BEData><clientKey>' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + x['eventTrackingNumber'] + '_' + x['officeCode'] + '</clientKey></BERecord>'
|
alertMsg = '<BERecord id="0000" locationKey="' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + x['eventTrackingNumber'] + '_' + x['officeCode'] + '" isWxscan="0"><action>NOT_USED</action><BEHdr><bPIL>' + x['productIdentifier'] + '</bPIL><bWMOHdr>NOT_USED</bWMOHdr><bEvent><eActionCd eActionPriority="' + str(x['messageTypeCode']) + '">' + Action + '</eActionCd><eOfficeId eOfficeNm="' + x['officeName'] + '">' + x['officeCode'] + '</eOfficeId><ePhenom>' + x['phenomena'] + '</ePhenom><eSgnfcnc>' + x['significance'] + '</eSgnfcnc><eETN>' + x['eventTrackingNumber'] + '</eETN><eDesc>' + x['eventDescription'] + '</eDesc><eStTmUTC>NOT_USED</eStTmUTC><eEndTmUTC>' + EndTimeUTC + '</eEndTmUTC><eSvrty>' + str(x['severityCode']) + '</eSvrty><eTWCIId>NOT_USED</eTWCIId><eExpTmUTC>' + expireTimeUTC + '</eExpTmUTC></bEvent><bLocations><bLocCd bLoc="' + x['areaName'] + '" bLocTyp="' + locationType + '">' + location + '</bLocCd><bStCd bSt="' + x['adminDistrict'] + '">' + x['adminDistrictCode'] + '</bStCd><bUTCDiff>NOT_USED</bUTCDiff><bTzAbbrv>NOT_USED</bTzAbbrv><bCntryCd>NOT_USED</bCntryCd></bLocations><bSgmtChksum>' + x['identifier'] + '</bSgmtChksum><procTm>' + processTime + '</procTm></BEHdr><BEData><bIssueTmUTC>' + issueTimeUtc + '</bIssueTmUTC><bHdln><bHdlnTxt>' + x['headlineText'] + '</bHdlnTxt>' + vocalCode + '</bHdln><bParameter>NOT_USED</bParameter><bNarrTxt bNarrTxtLang="en-US"><bLn>' + description + '</bLn></bNarrTxt><bSrchRslt>NOT_USED</bSrchRslt></BEData><clientKey>' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + x['eventTrackingNumber'] + '_' + x['officeCode'] + '</clientKey></BERecord>'
|
||||||
|
|
||||||
#Append BERecord
|
#Append BERecord
|
||||||
with open('D:\\BERecord.xml', "a") as b:
|
with open('./.temp/BERecord.xml', "a") as b:
|
||||||
b.write(alertMsg)
|
b.write(alertMsg)
|
||||||
b.close()
|
b.close()
|
||||||
|
|
||||||
@ -317,39 +317,39 @@ def getAlerts(location):
|
|||||||
# TODO: This should be converted into a function so it works better with async, that way we're not getting hung up on that time.sleep() call.
|
# TODO: This should be converted into a function so it works better with async, that way we're not getting hung up on that time.sleep() call.
|
||||||
|
|
||||||
def makeRecord():
|
def makeRecord():
|
||||||
with open("D:\\BERecord.xml", 'a') as BERecord:
|
with open("./.temp/BERecord.xml", 'a') as BERecord:
|
||||||
BERecord.write('<Data type="BERecord">')
|
BERecord.write('<Data type="BERecord">')
|
||||||
BERecord.close()
|
BERecord.close()
|
||||||
|
|
||||||
for z in zones:
|
for z in zones:
|
||||||
getAlerts(z)
|
getAlerts(z)
|
||||||
|
|
||||||
with open('D:\\BERecord.xml', 'a') as BERecord:
|
with open('./.temp/BERecord.xml', 'a') as BERecord:
|
||||||
BERecord.write("</Data>")
|
BERecord.write("</Data>")
|
||||||
BERecord.close()
|
BERecord.close()
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\BERecord.xml")
|
dom = xml.dom.minidom.parse("./.temp/BERecord.xml")
|
||||||
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\BERecord.i2m", 'w') as h:
|
with open("./.temp/BERecord.i2m", 'w') as h:
|
||||||
h.write(pretty_xml_as_string[23:])
|
h.write(pretty_xml_as_string[23:])
|
||||||
h.close()
|
h.close()
|
||||||
|
|
||||||
# If we don't need to send the i2 an alert, we don't need to gzip it.
|
# If we don't need to send the i2 an alert, we don't need to gzip it.
|
||||||
if k > 0:
|
if k > 0:
|
||||||
l.info("Sending alert(s) to the IntelliStar 2!")
|
l.info("Sending alert(s) to the IntelliStar 2!")
|
||||||
with open("D:\\BERecord.i2m", 'rb') as f_in:
|
with open("./.temp/BERecord.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\BERecord.gz", 'wb') as f_out:
|
with gzip.open("./.temp/BERecord.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
gZipFile = "D:\\BERecord.gz"
|
gZipFile = "./.temp/BERecord.gz"
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__BERecord__,Feed=BERecord)" /><GzipCompressedMsg fname="BERecord" /></MSG>')
|
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__BERecord__,Feed=BERecord)" /><GzipCompressedMsg fname="BERecord" /></MSG>')
|
||||||
bit.sendFile(files, commands, 1, 0)
|
bit.sendFile(files, commands, 1, 0)
|
||||||
os.remove(gZipFile)
|
os.remove(gZipFile)
|
||||||
k = 0
|
k = 0
|
||||||
|
|
||||||
os.remove("D:\\BERecord.xml")
|
os.remove("./.temp/BERecord.xml")
|
||||||
|
|
@ -45,7 +45,7 @@ def getData(coopId, geocode):
|
|||||||
#Write to .i2m file
|
#Write to .i2m file
|
||||||
i2Doc = '<Breathing id="000000000" locationKey="' + str(coopId) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(coopId) + '</clientKey></Breathing>'
|
i2Doc = '<Breathing id="000000000" locationKey="' + str(coopId) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(coopId) + '</clientKey></Breathing>'
|
||||||
|
|
||||||
f = open("D:\\Breathing.i2m", "a")
|
f = open("./.temp/Breathing.i2m", "a")
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -55,30 +55,30 @@ def makeDataFile():
|
|||||||
header = '<Data type="Breathing">'
|
header = '<Data type="Breathing">'
|
||||||
footer = '</Data>'
|
footer = '</Data>'
|
||||||
|
|
||||||
with open("D:\\Breathing.i2m", 'w') as doc:
|
with open("./.temp/Breathing.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for x, y in zip(coopIds, geocodes):
|
for x, y in zip(coopIds, geocodes):
|
||||||
getData(x, y)
|
getData(x, y)
|
||||||
|
|
||||||
with open("D:\\Breathing.i2m", 'a') as end:
|
with open("./.temp/Breathing.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\Breathing.i2m")
|
dom = xml.dom.minidom.parse("./.temp/Breathing.i2m")
|
||||||
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\Breathing.i2m", "w") as g:
|
with open("./.temp/Breathing.i2m", "w") as g:
|
||||||
g.write(pretty_xml_as_string[23:])
|
g.write(pretty_xml_as_string[23:])
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
with open("D:\\Breathing.i2m", 'rb') as f_in:
|
with open("./.temp/Breathing.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\Breathing.gz", 'wb') as f_out:
|
with gzip.open("./.temp/Breathing.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\Breathing.gz"
|
gZipFile = "./.temp/Breathing.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__Breathing__,Feed=Breathing)" /><GzipCompressedMsg fname="Breathing" /></MSG>')
|
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__Breathing__,Feed=Breathing)" /><GzipCompressedMsg fname="Breathing" /></MSG>')
|
||||||
@ -86,5 +86,5 @@ def makeDataFile():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\Breathing.i2m")
|
os.remove("./.temp/Breathing.i2m")
|
||||||
os.remove("D:\\Breathing.gz")
|
os.remove("./.temp/Breathing.gz")
|
@ -45,7 +45,7 @@ def getData(tecci, zipCode):
|
|||||||
i2Doc = '<CurrentObservations id="000000000" locationKey="' + str(tecci) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(tecci) + '</clientKey></CurrentObservations>'
|
i2Doc = '<CurrentObservations id="000000000" locationKey="' + str(tecci) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(tecci) + '</clientKey></CurrentObservations>'
|
||||||
|
|
||||||
|
|
||||||
f = open("D:\\CurrentObservations.i2m", "a")
|
f = open("./.temp/CurrentObservations.i2m", "a")
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -54,30 +54,30 @@ def makeDataFile():
|
|||||||
header = '<Data type="CurrentObservations">'
|
header = '<Data type="CurrentObservations">'
|
||||||
footer = '</Data>'
|
footer = '</Data>'
|
||||||
|
|
||||||
with open("D:\\CurrentObservations.i2m", 'w') as doc:
|
with open("./.temp/CurrentObservations.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for x, y in zip(tecciId, zipCodes):
|
for x, y in zip(tecciId, zipCodes):
|
||||||
getData(x, y)
|
getData(x, y)
|
||||||
|
|
||||||
with open("D:\\CurrentObservations.i2m", 'a') as end:
|
with open("./.temp/CurrentObservations.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\CurrentObservations.i2m")
|
dom = xml.dom.minidom.parse("./.temp/CurrentObservations.i2m")
|
||||||
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\CurrentObservations.i2m", "w") as g:
|
with open("./.temp/CurrentObservations.i2m", "w") as g:
|
||||||
g.write(pretty_xml_as_string[23:])
|
g.write(pretty_xml_as_string[23:])
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
|
|
||||||
with open("D:\\CurrentObservations.i2m", 'rb') as f_in:
|
with open("./.temp/CurrentObservations.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\CurrentObservations.gz", 'wb') as f_out:
|
with gzip.open("./.temp/CurrentObservations.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\CurrentObservations.gz"
|
gZipFile = "./.temp/CurrentObservations.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__CurrentObservations__,Feed=CurrentObservations)" /><GzipCompressedMsg fname="CurrentObservations" /></MSG>')
|
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__CurrentObservations__,Feed=CurrentObservations)" /><GzipCompressedMsg fname="CurrentObservations" /></MSG>')
|
||||||
@ -85,5 +85,5 @@ def makeDataFile():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\CurrentObservations.i2m")
|
os.remove("./.temp/CurrentObservations.i2m")
|
||||||
os.remove("D:\\CurrentObservations.gz")
|
os.remove("./.temp/CurrentObservations.gz")
|
||||||
|
@ -42,7 +42,7 @@ def getData(tecci, zipCode):
|
|||||||
#Write to .i2m file
|
#Write to .i2m file
|
||||||
i2Doc = '<DailyForecast id="000000000" locationKey="' + str(tecci) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(tecci) + '</clientKey></DailyForecast>'
|
i2Doc = '<DailyForecast id="000000000" locationKey="' + str(tecci) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(tecci) + '</clientKey></DailyForecast>'
|
||||||
|
|
||||||
f = open("D:\\DailyForecast.i2m", "a")
|
f = open("./.temp/DailyForecast.i2m", "a")
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -52,30 +52,30 @@ def makeDataFile():
|
|||||||
header = '<Data type="DailyForecast">'
|
header = '<Data type="DailyForecast">'
|
||||||
footer = '</Data>'
|
footer = '</Data>'
|
||||||
|
|
||||||
with open("D:\\DailyForecast.i2m", 'w') as doc:
|
with open("./.temp/DailyForecast.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for x, y in zip(tecciId, zipCodes):
|
for x, y in zip(tecciId, zipCodes):
|
||||||
getData(x, y)
|
getData(x, y)
|
||||||
|
|
||||||
with open("D:\\DailyForecast.i2m", 'a') as end:
|
with open("./.temp/DailyForecast.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\DailyForecast.i2m")
|
dom = xml.dom.minidom.parse("./.temp/DailyForecast.i2m")
|
||||||
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\DailyForecast.i2m", "w") as g:
|
with open("./.temp/DailyForecast.i2m", "w") as g:
|
||||||
g.write(pretty_xml_as_string[23:])
|
g.write(pretty_xml_as_string[23:])
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
with open("D:\\DailyForecast.i2m", 'rb') as f_in:
|
with open("./.temp/DailyForecast.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\DailyForecast.gz", 'wb') as f_out:
|
with gzip.open("./.temp/DailyForecast.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\DailyForecast.gz"
|
gZipFile = "./.temp/DailyForecast.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__DailyForecast__,Feed=DailyForecast)" /><GzipCompressedMsg fname="DailyForecast" /></MSG>')
|
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__DailyForecast__,Feed=DailyForecast)" /><GzipCompressedMsg fname="DailyForecast" /></MSG>')
|
||||||
@ -83,5 +83,5 @@ def makeDataFile():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\DailyForecast.i2m")
|
os.remove("./.temp/DailyForecast.i2m")
|
||||||
os.remove("D:\\DailyForecast.gz")
|
os.remove("./.temp/DailyForecast.gz")
|
@ -42,7 +42,7 @@ def getData(tecci, zipCode):
|
|||||||
#Write to .i2m file
|
#Write to .i2m file
|
||||||
i2Doc = '<HourlyForecast id="000000000" locationKey="' + str(tecci) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(tecci) + '</clientKey></HourlyForecast>'
|
i2Doc = '<HourlyForecast id="000000000" locationKey="' + str(tecci) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(tecci) + '</clientKey></HourlyForecast>'
|
||||||
|
|
||||||
f = open("D:\\HourlyForecast.i2m", "a")
|
f = open("./.temp/HourlyForecast.i2m", "a")
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -51,30 +51,30 @@ def makeDataFile():
|
|||||||
header = '<Data type="HourlyForecast">'
|
header = '<Data type="HourlyForecast">'
|
||||||
footer = '</Data>'
|
footer = '</Data>'
|
||||||
|
|
||||||
with open("D:\\HourlyForecast.i2m", 'w') as doc:
|
with open("./.temp/HourlyForecast.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for x, y in zip(tecciId, zipCodes):
|
for x, y in zip(tecciId, zipCodes):
|
||||||
getData(x, y)
|
getData(x, y)
|
||||||
|
|
||||||
with open("D:\\HourlyForecast.i2m", 'a') as end:
|
with open("./.temp/HourlyForecast.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\HourlyForecast.i2m")
|
dom = xml.dom.minidom.parse("./.temp/HourlyForecast.i2m")
|
||||||
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\HourlyForecast.i2m", "w") as g:
|
with open("./.temp/HourlyForecast.i2m", "w") as g:
|
||||||
g.write(pretty_xml_as_string[23:])
|
g.write(pretty_xml_as_string[23:])
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
with open("D:\\HourlyForecast.i2m", 'rb') as f_in:
|
with open("./.temp/HourlyForecast.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\HourlyForecast.gz", 'wb') as f_out:
|
with gzip.open("./.temp/HourlyForecast.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\HourlyForecast.gz"
|
gZipFile = "./.temp/HourlyForecast.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__HourlyForecast__,Feed=HourlyForecast)" /><GzipCompressedMsg fname="HourlyForecast" /></MSG>')
|
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__HourlyForecast__,Feed=HourlyForecast)" /><GzipCompressedMsg fname="HourlyForecast" /></MSG>')
|
||||||
@ -82,5 +82,5 @@ def makeDataFile():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\HourlyForecast.i2m")
|
os.remove("./.temp/HourlyForecast.i2m")
|
||||||
os.remove("D:\\HourlyForecast.gz")
|
os.remove("./.temp/HourlyForecast.gz")
|
@ -46,7 +46,7 @@ def getData(pollenId, geocode):
|
|||||||
#Write to .i2m file
|
#Write to .i2m file
|
||||||
i2Doc = '<PollenForecast id="000000000" locationKey="' + str(pollenId) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(pollenId) + '</clientKey></PollenForecast>'
|
i2Doc = '<PollenForecast id="000000000" locationKey="' + str(pollenId) + '" isWxscan="0">' + '' + newData + '<clientKey>' + str(pollenId) + '</clientKey></PollenForecast>'
|
||||||
|
|
||||||
f = open("D:\\PollenForecast.i2m", "a")
|
f = open("./.temp/PollenForecast.i2m", "a")
|
||||||
f.write(i2Doc)
|
f.write(i2Doc)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -56,30 +56,30 @@ def makeDataFile():
|
|||||||
header = '<Data type="PollenForecast">'
|
header = '<Data type="PollenForecast">'
|
||||||
footer = '</Data>'
|
footer = '</Data>'
|
||||||
|
|
||||||
with open("D:\\PollenForecast.i2m", 'w') as doc:
|
with open("./.temp/PollenForecast.i2m", 'w') as doc:
|
||||||
doc.write(header)
|
doc.write(header)
|
||||||
|
|
||||||
for x, y in zip(pollenIds, geocodes):
|
for x, y in zip(pollenIds, geocodes):
|
||||||
getData(x, y)
|
getData(x, y)
|
||||||
|
|
||||||
with open("D:\\PollenForecast.i2m", 'a') as end:
|
with open("./.temp/PollenForecast.i2m", 'a') as end:
|
||||||
end.write(footer)
|
end.write(footer)
|
||||||
|
|
||||||
|
|
||||||
dom = xml.dom.minidom.parse("D:\\PollenForecast.i2m")
|
dom = xml.dom.minidom.parse("./.temp/PollenForecast.i2m")
|
||||||
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
pretty_xml_as_string = dom.toprettyxml(indent = " ")
|
||||||
|
|
||||||
with open("D:\\PollenForecast.i2m", "w") as g:
|
with open("./.temp/PollenForecast.i2m", "w") as g:
|
||||||
g.write(pretty_xml_as_string[23:])
|
g.write(pretty_xml_as_string[23:])
|
||||||
g.close()
|
g.close()
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
commands = []
|
commands = []
|
||||||
with open("D:\\PollenForecast.i2m", 'rb') as f_in:
|
with open("./.temp/PollenForecast.i2m", 'rb') as f_in:
|
||||||
with gzip.open("D:\\PollenForecast.gz", 'wb') as f_out:
|
with gzip.open("./.temp/PollenForecast.gz", 'wb') as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
gZipFile = "D:\\PollenForecast.gz"
|
gZipFile = "./.temp/PollenForecast.gz"
|
||||||
|
|
||||||
files.append(gZipFile)
|
files.append(gZipFile)
|
||||||
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__PollenForecast__,Feed=PollenForecast)" /><GzipCompressedMsg fname="PollenForecast" /></MSG>')
|
command = commands.append('<MSG><Exec workRequest="storeData(File={0},QGROUP=__PollenForecast__,Feed=PollenForecast)" /><GzipCompressedMsg fname="PollenForecast" /></MSG>')
|
||||||
@ -87,5 +87,5 @@ def makeDataFile():
|
|||||||
|
|
||||||
bit.sendFile(files, commands, numFiles, 0)
|
bit.sendFile(files, commands, numFiles, 0)
|
||||||
|
|
||||||
os.remove("D:\\PollenForecast.i2m")
|
os.remove("./.temp/PollenForecast.i2m")
|
||||||
os.remove("D:\\PollenForecast.gz")
|
os.remove("./.temp/PollenForecast.gz")
|
Loading…
x
Reference in New Issue
Block a user