From eb2def1a67d77bbdc682c47a2b949732f8dc808b Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Tue, 31 Dec 2019 08:26:54 -0600 Subject: [PATCH] remove references to "curDir" and replace them with "PATH" and "LOG_PATH". This allows the program to be invoked from any arbitrary location and still propery locate the lastheard log and HTML templates. --- monitor.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monitor.py b/monitor.py index a039276..3031997 100644 --- a/monitor.py +++ b/monitor.py @@ -530,20 +530,19 @@ def process_message(_bmessage): # log only to file if system is NOT OpenBridge event (not logging open bridge system, name depends on your OB definitions) AND transmit time is LONGER as 2sec (make sense for very short transmits) if LASTHEARD_INC: if int(float(p[9]))> 2: - curDir = os.getcwd() log_lh_message = '{},{},{},{},{},{},{},TS{},TG{},{},{},{}'.format(_now, p[9], p[0], p[1], p[3], p[5], alias_call(int(p[5]), subscriber_ids), p[7], p[8],alias_tgid(int(p[8]),talkgroup_ids),p[6], alias_short(int(p[6]), subscriber_ids)) - lh_logfile = open(curDir+"/log/lastheard.log", "a") + lh_logfile = open(LOG_PATH+"lastheard.log", "a") lh_logfile.write(log_lh_message + '\n') lh_logfile.close() # Lastheard in Dashboard by SP2ONG my_list=[] n=0 - f = open(curDir+"/templates/lastheard.html", "w") + f = open(PATH+"templates/lastheard.html", "w") f.write("
\n") f.write(" .: Lastheard :. \n") f.write("\n") f.write("\n") - with open(curDir+"/log/lastheard.log", "r") as textfile: + with open(LOG_PATH+"lastheard.log", "r") as textfile: for row in islice(reversed(list(csv.reader(textfile))),100): duration=row[1] dur=str(int(float(duration.strip())))
DateTimeSlotTG#TG NameCallsign (DMR-Id)NameDur TX (s)Source IDSystem