You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.7 KiB

#!/usr/bin/env python3
# This script monitors the logfile of WSJT-X or
# JTDX and uploads new log entries to Cloudlog
# URL:
# Orignal version from Christopher, M0YNG
# URL:
# Modified by Michael Clemens, DL6MHC
# Imports for stuff
import configparser
import requests
import os
import time
# read in the config
config = configparser.ConfigParser()'config.ini')
# Some fixed common things
qsourl = '/index.php/api/qso'
# What to do when we find a new contact
def pushContact(filename, lines):
for line in lines:
r =
config['cloudlog']['host'] + qsourl,
json={"key": config['cloudlog']['key'],
"type": "adif",
"string": line
if r.status_code == 201:
print("Log uploaded to Cloudlog.")
print('Something went wrong')
# open log file and set the pointer to its last line
def openFile(filename):
if os.path.isfile(filename):
logfile = open(filename, "r")
print("Watching file %s" % filename)
return logfile
print ("%s does not exist" % filename)
# monitor the logfile for new lines
def loop(logfile):
while 1:
new_entry = logfile.readlines()
if new_entry:
pushContact(, new_entry)
# open log file
logfile = openFile(config['cloudlog']['file'])
# start the watching
if not logfile:
print("Something went wrong while opening the log file")