Skip to content

Commit

Permalink
fixed indents
Browse files Browse the repository at this point in the history
  • Loading branch information
shmget committed Apr 12, 2020
1 parent 91b8ef0 commit ef95313
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions nxcm_log_icom/nxcm_icom_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@

def writeout():

while True:
time.sleep(15)
outfile = open(OUTPUT_HTMLFILE, 'w')
outfile.write("<html><head><title>Icom NXDN Log</title>")
outfile.write("<meta http-equiv='refresh' content='10'>")
outfile.write("</head><body><center><h2>N1XDN Connecticut NXCM Icom Log</h2></center>")
outfile.write("<br/><br/><br/><p>")
outfile.write("<table border='1' style='border-collapse:collapse'><tr><td width='260'><b>Last Heard</b></td><td width='250'><b>User / UID</b></td> \
<td width='250'><b>Talkgroup / GID</b></td><td width='200'><b>Repeater</b></td><td><b>RX RAN</b></td><td width='90'><b>Status</b></td></b></tr>")
for i in range(0,len(packetlist)):
outfile.write(packetlist[i])
outfile.write("\n")
outfile.write("</table></p></body></html>")
outfile.close()
while True:
time.sleep(15)
outfile = open(OUTPUT_HTMLFILE, 'w')
outfile.write("<html><head><title>Icom NXDN Log</title>")
outfile.write("<meta http-equiv='refresh' content='10'>")
outfile.write("</head><body><center><h2>N1XDN Connecticut NXCM Icom Log</h2></center>")
outfile.write("<br/><br/><br/><p>")
outfile.write("<table border='1' style='border-collapse:collapse'><tr><td width='260'><b>Last Heard</b></td><td width='250'><b>User / UID</b></td> \
<td width='250'><b>Talkgroup / GID</b></td><td width='200'><b>Repeater</b></td><td><b>RX RAN</b></td><td width='90'><b>Status</b></td></b></tr>")
for i in range(0,len(packetlist)):
outfile.write(packetlist[i])
outfile.write("\n")
outfile.write("</table></p></body></html>")
outfile.close()


t = threading.Thread(target=writeout)
t.start()

uid_dict = {}
with open('uid.csv') as csvfile:
uidreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in uidreader:
if row[0].isdigit():
tempstr = row[1] + " - " + row[2]
if len(row[3]) > 0:
tempstr += " - " + row[3]
tempstr += "<br/>(<b>" + row[0] + "</b>)"
uid_dict[row[0]] = tempstr
else:
uid_dict[row[0]] = row[0]
uidreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in uidreader:
if row[0].isdigit():
tempstr = row[1] + " - " + row[2]
if len(row[3]) > 0:
tempstr += " - " + row[3]
tempstr += "<br/>(<b>" + row[0] + "</b>)"
uid_dict[row[0]] = tempstr
else:
uid_dict[row[0]] = row[0]



Expand All @@ -60,27 +60,27 @@ def writeout():

if ((ord(data[38]) == 0x1c) and (ord(data[39]) == 0x21)):

UID = (ord(data[48]) << 8) + ord(data[49])
GID = (ord(data[50]) << 8) + ord(data[51])
RAN = ord(data[41])
if (UID == 0):
continue
UID = (ord(data[48]) << 8) + ord(data[49])
GID = (ord(data[50]) << 8) + ord(data[51])
RAN = ord(data[41])
if (UID == 0):
continue

rpt = ""
rpt = ""

for item in rpt_list:
if (ord(data[97])==item[3]) and (ord(data[98])==item[2]) and (ord(data[99])==item[1]) and (ord(data[100])==item[0]):
rpt = item[4]
for item in rpt_list:
if (ord(data[97])==item[3]) and (ord(data[98])==item[2]) and (ord(data[99])==item[1]) and (ord(data[100])==item[0]):
rpt = item[4]

gidstr = tg_dict.get(GID)
if not gidstr:
gidstr = str(GID)
gidstr = tg_dict.get(GID)
if not gidstr:
gidstr = str(GID)

uidstr = uid_dict.get(str(UID))
if not uidstr:
uidstr = str(UID)
uidstr = uid_dict.get(str(UID))
if not uidstr:
uidstr = str(UID)

if ord(data[45]) == 1:
packetlist.appendleft("<tr><td><center> "+ time.strftime("%c, %z") + "</center></td><td><center> " + uidstr + "</center></td><td><center> " + gidstr + "</center></td><td><center> " + rpt + "</center></td><td><center>" + str(RAN) + "</center></td><td><center>PTT On</center></td></tr>")
if ord(data[45]) == 8:
packetlist.appendleft("<tr bgcolor='#87CEFA'><td><center> "+ time.strftime("%c, %z") + "</center></td><td><center> " + uidstr + "</center></td><td><center> " + gidstr + "</center></td><td><center> " + rpt + "</center></td><td><center>" + str(RAN) + "</center></td><td><center>PTT Off</center></td></tr>")
if ord(data[45]) == 1:
packetlist.appendleft("<tr><td><center> "+ time.strftime("%c, %z") + "</center></td><td><center> " + uidstr + "</center></td><td><center> " + gidstr + "</center></td><td><center> " + rpt + "</center></td><td><center>" + str(RAN) + "</center></td><td><center>PTT On</center></td></tr>")
if ord(data[45]) == 8:
packetlist.appendleft("<tr bgcolor='#87CEFA'><td><center> "+ time.strftime("%c, %z") + "</center></td><td><center> " + uidstr + "</center></td><td><center> " + gidstr + "</center></td><td><center> " + rpt + "</center></td><td><center>" + str(RAN) + "</center></td><td><center>PTT Off</center></td></tr>")

0 comments on commit ef95313

Please sign in to comment.