Added automatically reloading of DMR_ID-list after (configured) time.
Configure your time in logtailer.ini as DMR_ID_Reload_Time Also removed sleep in service-files and modified TG-List.csv
This commit is contained in:
parent
31d373beff
commit
9f63c75118
6 changed files with 51 additions and 25 deletions
|
@ -9,10 +9,10 @@ YSF,0,40,DL Multimode 263,https://c4fm.ysfreflector.de/Germany/
|
|||
YSF,0,41,DL-RAMSES,http://161.97.140.131:8000/RAMSES.html
|
||||
YSF,0,42,DL-RAMSES-II,http://161.97.140.131:8000/RAMSES-II.html
|
||||
YSF,0,43,DL-RAMSES-III,
|
||||
YSF,0,44,DL-PEGASUS,
|
||||
YSF,0,44,DL-PEGASUS,https://ysf.projekt-pegasus.net/1/
|
||||
YSF,0,45,DL-SAAR,https://c4fm.ysfreflector.de/DL-Saar/
|
||||
YSF,0,46,DE-Twitterrunde,https://c4fm.ysfreflector.de/Twitterrunde/
|
||||
YSF,0,47,DE-Westpfalz,https://westpfalz.ysfreflector.de
|
||||
YSF,0,48,DE-Deutschland,
|
||||
YSF,0,49,America Link,
|
||||
YSF,0,49,DE-IG-Hamspirit,http://92.205.24.245:8000/
|
||||
YSF,0,99,Network Parrot,
|
||||
|
|
|
|
@ -1 +1 @@
|
|||
var dashboard_version = "2021-05-01 12:17:01";
|
||||
var dashboard_version = "2022-01-28 19:14:32";
|
||||
|
|
|
@ -30,6 +30,9 @@ Prefix=MMDVM
|
|||
DMR_ID_Lookup=1
|
||||
DMR_ID_LookupFile=/etc/MMDVM/DMRIds.dat
|
||||
|
||||
# This is the reload-timer for refreshing DMR-ID-Database every x minutes (1440 = 24h = once a day every 24 hours after starting the logtailer)
|
||||
DMR_ID_Reload_Time=1440
|
||||
|
||||
# Location of your MMDVM.ini/DMRHost.ini or similar
|
||||
MMDVM_ini=/etc/MMDVM/MMDVM.ini
|
||||
|
||||
|
@ -47,3 +50,4 @@ BinaryName1=MMDVMHost
|
|||
BinaryName2=DMRGateway
|
||||
BinaryName3=DGIdGateway
|
||||
BinaryName4=YSF2DMR
|
||||
BinaryName5=DAPNETGateway
|
||||
|
|
58
logtailer.py
58
logtailer.py
|
@ -21,6 +21,7 @@ from http import HTTPStatus
|
|||
import subprocess
|
||||
import time
|
||||
import serial
|
||||
import threading
|
||||
|
||||
MIME_TYPES = {
|
||||
"html": "text/html",
|
||||
|
@ -41,6 +42,14 @@ callsigns = {}
|
|||
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
|
||||
conv = Ansi2HTMLConverter(inline=True)
|
||||
|
||||
|
||||
def reload_callsign_database():
|
||||
while True:
|
||||
time.sleep(60*int(config['MMDVMHost']['DMR_ID_Reload_Time']))
|
||||
logging.info("Reloading DMR_IDs")
|
||||
load_callsign_database()
|
||||
|
||||
|
||||
def getMMDVMVersion():
|
||||
mmdvm_version = "Actually not available"
|
||||
mmdvm_version = getMMDVMVersionFromLogfile()
|
||||
|
@ -375,31 +384,42 @@ def websocketserver():
|
|||
asyncio.get_event_loop().run_until_complete(start_server)
|
||||
asyncio.get_event_loop().run_forever()
|
||||
|
||||
|
||||
def load_callsign_database():
|
||||
dmr_id_lookupfile = config['MMDVMHost']['DMR_ID_LookupFile']
|
||||
if not os.path.isfile(dmr_id_lookupfile):
|
||||
raise ValueError('File not found', format(dmr_id_lookupfile))
|
||||
|
||||
f = open(dmr_id_lookupfile, 'r')
|
||||
lines = f.readlines()
|
||||
separator = "\t"
|
||||
for line in lines:
|
||||
if line.find(" "):
|
||||
separator = " "
|
||||
if line.find(";"):
|
||||
separator = ";"
|
||||
if line.find(","):
|
||||
separator = ","
|
||||
if line.find("\t"):
|
||||
separator = "\t"
|
||||
tokens = line.split(separator)
|
||||
dmrids[tokens[0]] = tokens[1] + "$" + tokens[2].replace("\r", "").replace("\n", "") + "$"
|
||||
callsigns[tokens[1]] = tokens[2].replace("\r", "").replace("\n", "")
|
||||
logging.info("Loaded " + str(len(callsigns)) + " callsigns from " + dmr_id_lookupfile);
|
||||
f.close()
|
||||
|
||||
|
||||
def main():
|
||||
dmr_id_lookup = config['MMDVMHost']['DMR_ID_Lookup']
|
||||
dmr_id_lookupfile = config['MMDVMHost']['DMR_ID_LookupFile']
|
||||
|
||||
if dmr_id_lookup == "1":
|
||||
if not os.path.isfile(dmr_id_lookupfile):
|
||||
raise ValueError('File not found', format(dmr_id_lookupfile))
|
||||
logging.info("Loading DMR_IDs from file")
|
||||
load_callsign_database()
|
||||
t2 = threading.Thread(target=reload_callsign_database)
|
||||
t2.start()
|
||||
|
||||
f = open(dmr_id_lookupfile, 'r')
|
||||
lines = f.readlines()
|
||||
separator = "\t"
|
||||
for line in lines:
|
||||
if line.find(" "):
|
||||
separator = " "
|
||||
if line.find(";"):
|
||||
separator = ";"
|
||||
if line.find(","):
|
||||
separator = ","
|
||||
if line.find("\t"):
|
||||
separator = "\t"
|
||||
tokens = line.split(separator)
|
||||
dmrids[tokens[0]] = tokens[1] + "$" + tokens[2].replace("\r", "").replace("\n", "") + "$"
|
||||
callsigns[tokens[1]] = tokens[2].replace("\r", "").replace("\n", "")
|
||||
logging.info("Loaded " + str(len(callsigns)) + " callsigns from " + dmr_id_lookupfile);
|
||||
logging.info("Starting Websocketserver")
|
||||
|
||||
websocketserver()
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ Type=simple
|
|||
User=mmdvm
|
||||
Group=mmdvm
|
||||
Restart=always
|
||||
ExecStartPre=/bin/sleep 30
|
||||
# uncomment if you want to wait (not neccessary)
|
||||
# ExecStartPre=/bin/sleep 30
|
||||
# Modify for different location of Python3 or other port
|
||||
ExecStart=/usr/bin/python3 -m http.server 8000 --directory /opt/MMDVMDash/html
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ Type=simple
|
|||
User=mmdvm
|
||||
Group=mmdvm
|
||||
Restart=always
|
||||
ExecStartPre=/bin/sleep 30
|
||||
# uncomment if you want to wait (not neccessary)
|
||||
# ExecStartPre=/bin/sleep 30
|
||||
# Modify for different location of Python3 or other port
|
||||
WorkingDirectory=/opt/MMDVMDash/
|
||||
ExecStart=/usr/bin/python3 /opt/MMDVMDash/logtailer.py
|
||||
|
|
Loading…
Add table
Reference in a new issue