diff --git a/html/data/TG_List.csv b/html/data/TG_List.csv index a1f89dc..fd8a4bf 100644 --- a/html/data/TG_List.csv +++ b/html/data/TG_List.csv @@ -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, diff --git a/html/js/version.js b/html/js/version.js index 62bb099..69e29b3 100644 --- a/html/js/version.js +++ b/html/js/version.js @@ -1 +1 @@ -var dashboard_version = "2021-05-01 12:17:01"; +var dashboard_version = "2022-01-28 19:14:32"; diff --git a/logtailer.ini b/logtailer.ini index b81c64d..e838fbd 100644 --- a/logtailer.ini +++ b/logtailer.ini @@ -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 diff --git a/logtailer.py b/logtailer.py index 16a822c..aa0d780 100644 --- a/logtailer.py +++ b/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)) - - 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("Loading DMR_IDs from file") + load_callsign_database() + t2 = threading.Thread(target=reload_callsign_database) + t2.start() + logging.info("Starting Websocketserver") + websocketserver() diff --git a/systemd/http.server.service b/systemd/http.server.service index cfdf9c3..37711b4 100644 --- a/systemd/http.server.service +++ b/systemd/http.server.service @@ -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 diff --git a/systemd/logtailer.service b/systemd/logtailer.service index 49fcb26..abec973 100644 --- a/systemd/logtailer.service +++ b/systemd/logtailer.service @@ -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