Move data to temp directory

This commit is contained in:
needlenose
2022-10-18 20:40:28 -07:00
parent 2fcf8a033e
commit e8554e81ed
12 changed files with 115 additions and 113 deletions

View File

@ -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...")
exit()
#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()
msgNum = int(oMsgId)
f.close()
nMsgNum = msgNum + 1
h = open('C:\\Clips\\msgId.txt', "w")
h = open('./.temp/msgId.txt', "w")
h.write(str(nMsgNum))
h.close()
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...")
exit()
#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()
msgNum = int(oMsgId)
f.close()
nMsgNum = msgNum + 1
h = open('C:\\Clips\\msgId.txt', "w")
h = open('./.temp/msgId.txt', "w")
h.write(str(nMsgNum))
h.close()
segnmNum = 0
@ -140,15 +140,15 @@ def sendCommand(command, Pri, msgNum = None):
for x in command:
bx = bytes(x, 'utf-8')
with open('D:\\command', 'wb') as c:
with open('./.temp/command', 'wb') as c:
c.write(bx)
c.close()
size = os.path.getsize('D:\\command')
size = os.path.getsize('./.temp/command')
encode1 = bytes('I2MSG', 'UTF-8')
commandLength = size
encode2 = commandLength.to_bytes(4, byteorder='little')
theCommand = b"".join([encode1, encode2])
with open('D:\\command', 'ab') as d:
with open('./.temp/command', 'ab') as d:
d.write(theCommand)
d.close()
check = size - BUF_SIZE
@ -162,14 +162,14 @@ def sendCommand(command, Pri, msgNum = None):
pc = packet_count.to_bytes(4, byteorder='little')
i = 0
char = ''
new_size = os.path.getsize('D:\\command')
new_size = os.path.getsize('./.temp/command')
if startFlag == False:
#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)
conn.sendto(p1, (MCAST_GRP, MCAST_PORT))
startFlag = True
with open('D:\\Command',"rb") as message:
with open('./.temp/Command',"rb") as message:
message.seek(0)
data = message.read(BUF_SIZE)
while data:
@ -212,16 +212,16 @@ def sendCommand(command, Pri, msgNum = None):
#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)
#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)
#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
#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
#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)
#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
#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
#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
#sendCommand('<MSG><Exec workRequest="stageUpgrade(File={0},InstallImmediately=False,ReleaseName=maintenance_1.0.0.50)" /></MSG>I2MSG', 0)
#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)

View File

@ -129,7 +129,7 @@ def sendStarBundle(File):
count = file_number - 1
part = 1
with open('C:\\Clips\\msgId.txt', "r") as f:
with open('./.temp/msgId.txt', "r") as f:
oMsgId = f.read()
Id = int(oMsgId)
f.close()
@ -186,7 +186,7 @@ def sendUpgrade(File, RelName):
count = file_number - 1
part = 1
with open('C:\\Clips\\msgId.txt', "r") as f:
with open('./.temp/msgId.txt', "r") as f:
oMsgId = f.read()
Id = int(oMsgId)
f.close()
@ -213,7 +213,7 @@ def sendUpgrade(File, RelName):
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'
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.close()
@ -222,7 +222,7 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
rootDir = root[24:]
bDest = os.path.join(rootDir,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:
if flag == 'Domestic_Universe':
flag = 'flags="Domestic_Universe"'
@ -230,11 +230,11 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
flag = 'flags="Domestic_SD_Universe"'
else:
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.close()
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.close()
@ -249,22 +249,22 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
#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
#sendUpgrade("C:\\Clips\\ChangesetHD.zip", "PipelineMaint_6.15.1.5714")
#sendUpgrade("./.temp/ChangesetHD.zip", "PipelineMaint_6.15.1.5714")
#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
#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
@ -274,7 +274,7 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter):
#commands.append(command)
#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=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="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)
#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)

View File

@ -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)
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)