diff --git a/monitor.py b/monitor.py index d3a3305..782bd7f 100644 --- a/monitor.py +++ b/monitor.py @@ -775,42 +775,42 @@ def process_message(_bmessage): f.write("\n") f.write("\n") with open(LOG_PATH+"lastheard.log", "r") as textfile: - for row in islice(reversed(list(csv.reader(textfile))),400): - duration_in_s = 0 - duration=row[1] - dur=str(int(float(duration.strip()))) - year=int(float(row[0][:4].strip())) - month=int(float(row[0][5:7].strip())) - day=int(float(row[0][8:10].strip())) - hour=int(float(row[0][11:13].strip())) - min=int(float(row[0][14:16].strip())) - sec=int(float(row[0][17:19].strip())) - then = datetime.datetime(year, month, day, hour, min, sec) - now = datetime.datetime.now() - durations = now - then - duration_in_s = durations.total_seconds() - if dur=="0" and row[3]=="START": - durtx='' - else: - durtx="" - if (row[3]=="START" and duration_in_s < 260) or (row[3]=="END"): - if row[10] not in my_list: - if row[11].strip().isdigit() or row[11] == "N0CALL" or row[11] == "NOCALL": - qrz = ""+row[11]+"" - else: - qrz = ""+row[11]+" ("+row[10]+")" - if len(row) < 13: - hline=""+durtx+"" - my_list.append(row[10]) - n += 1 - else: - hline=""+durtx+"" - my_list.append(row[10]) - n += 1 - f.write(hline+"\n") - # n is max number items in lastheard table - if n == 15: - break + for row in islice(reversed(list(csv.reader(textfile))),400): + duration_in_s = 0 + duration=row[1] + dur=str(int(float(duration.strip()))) + year=int(float(row[0][:4].strip())) + month=int(float(row[0][5:7].strip())) + day=int(float(row[0][8:10].strip())) + hour=int(float(row[0][11:13].strip())) + min=int(float(row[0][14:16].strip())) + sec=int(float(row[0][17:19].strip())) + then = datetime.datetime(year, month, day, hour, min, sec) + now = datetime.datetime.now() + durations = now - then + duration_in_s = durations.total_seconds() + if dur=="0" and row[3]=="START": + durtx='' + else: + durtx="" + if (row[3]=="START" and duration_in_s < 260) or (row[3]=="END"): + if row[10] not in my_list: + if row[11].strip().isdigit() or row[11] == "N0CALL" or row[11] == "NOCALL": + qrz = ""+row[11]+"" + else: + qrz = ""+row[11]+" ("+row[10]+")" + if len(row) < 13: + hline=""+durtx+"" + my_list.append(row[10]) + n += 1 + else: + hline=""+durtx+"" + my_list.append(row[10]) + n += 1 + f.write(hline+"\n") + # n max number items in lastheard table + if n == 15: + break f.write("
DateTimeCallsign (DMR-Id)NameTG#TG Name TX (s) SlotSystem
TX-ing"+str(int(float(duration.strip())))+"
"+row[0][:10]+""+row[0][11:16]+""+qrz+""+row[8][2:]+""+row[9]+""+row[7][2:]+""+row[4]+"
"+row[0][:10]+""+row[0][11:16]+""+qrz+""+row[12]+""+row[8][2:]+""+row[9]+""+row[7][2:]+""+row[4]+"
TX-ing"+str(int(float(duration.strip())))+"
"+row[0][:10]+""+row[0][11:16]+""+qrz+""+row[8][2:]+""+row[9]+""+row[7][2:]+""+row[4]+"
"+row[0][:10]+""+row[0][11:16]+""+qrz+""+row[12]+""+row[8][2:]+""+row[9]+""+row[7][2:]+""+row[4]+"

") f.close() # refresh main page