From 86b32701b38f8ffd572f8ba5234ae8760c58df84 Mon Sep 17 00:00:00 2001 From: nq4t Date: Thu, 2 Feb 2023 20:17:46 +0000 Subject: [PATCH] Update For CSS --- README.md | 5 ++++- log4om.py | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 62ca039..a78ae99 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ continually update this file as messages come in. It requires you to let Log4OM ### Usage Place the script on a system that can hear UDP from Log4OM and has a way of putting the resulting HTML file on a webserver -as fast as possible. +as fast as possible. Edit the script as required (IP, port, output location, HTML formatting). ### Basic Operation @@ -23,3 +23,6 @@ off and wait for data to come back. Support is planned to show if rig is in tran The "Radio Off" message happens after 15 seconds of no data. This is done by checking the elapsed time since the timestamo was last updated; which happens every time a message comes in. + +The script contains examples of how to add additional portions of HTML. This was done for nq4t.com. They are commented out by +default. You will need to modify this as you require. diff --git a/log4om.py b/log4om.py index 7a1c72d..6d45ba8 100644 --- a/log4om.py +++ b/log4om.py @@ -18,7 +18,7 @@ def monitor(): if tc < 15: #15 seconds time.sleep(6) else: - writehtml(f"Radio Off or Log4OM Not Running", False) + writehtml(f"Radio Off or Log4OM Not Running", False) #writehtml() requires two arguements and you can't be on air if radio is off time.sleep(30) # Slow checks when radio off/no UDP def log4om(): @@ -34,24 +34,28 @@ def log4om(): tf = tx_freq / 100 sv = tf - f # Determines split value if sv > 0: - writehtml(f"Frequency: {f}kHz {mode}
Tx Split Up: {sv:.2f} kHz", onair) + writehtml(f"Frequency: {f}kHz {mode}
Tx Split · Up: {sv:.2f} kHz", onair) elif sv < 0: sv = sv * -1 # Invert negative numbers - writehtml(f"Frequency: {f}kHz {mode}
Tx Split Down: {sv:.2f} kHz", onair) + writehtml(f"Frequency: {f}kHz {mode}
Tx Split · Down: {sv:.2f} kHz", onair) else: writehtml(f"Frequency: {f}kHz {mode}", onair) tot = time.time() #timestamp time.sleep(.1) def writehtml(rs, t = "true"): - header = "\n\nFT-1000MP Status\n\n\n\n" - footer = "\n\n" - isonair = "ON THE AIR
\n" + header = "\n\nFT-1000MP Status\n\n\n" # Basic Header + #css = "\n\n" # This adds my CSS files. + #div = "
" # This is additional formatting + footer = "\n
\n" # footer + isonair = "ON THE AIR
\n" # on-air html with open("/var/www/log/radio.html", "w") as html: # Modifiy file location as needed. if t == True: # Checks for on-air - html.write(header + isonair + rs + footer) + #html.write(header + css + div + isonair + rs + footer) # This will add additional variables (for css, etc.) to the HTML file. + html.write (header + isonair + rs + footer) # No formatting version if t == False: # Checks for on-air - html.write(header + rs + footer) + #html.write(header + css + div + rs + footer) # Same as above without isonair, use if additional html is used + html.write(header + rs + footer) # No formatting version T = Thread(target=monitor,daemon=True) # Daemon the monitor thread L = Thread(target=log4om)