-- Leo's gemini proxy

-- Connecting to m0yng.uk:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en

CloudPusher - logging WSJT-X to Cloudlog - M0YNG.uk

Created 2020-05-17

Tagged

Code

Amateur Radio


Recently I managed to have some success with FT8, which was great! But I didn't want to have to log contact manually. I've also started using CloudLog[1] (which you can view at https://log.m0yng.uk[2])


1: https://www.magicbug.co.uk/cloudlog/

2: https://log.m0yng.uk


I looked around and didn't find anything simple and native for Linux to do this log uploading (I'm sure there are things I didn't find, but ๐Ÿคท)


Previously I've (ab)used a handy Python script by Giampaolo Rodola' which find and watches log files watch_log.py[3], and I knew that WSJT-X generates an adi file, and that CloudLog had an API that can accept adi lines.


3: https://gist.github.com/albsen/3903930


CloudPusher Code


#!/usr/bin/env python3

# Imports for stuff
import configparser
import watch_log
import requests

# read in the config
config = configparser.ConfigParser()
config.read('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 = requests.post(
            config['cloudlog']['host'] + qsourl,
            json={"key": config['cloudlog']['key'],
                  "type": "adif",
                  "string": line
                  }
        )
        if r.status_code == 201:
            print('๐Ÿ˜ƒ log created!')
        else:
            print('๐Ÿ˜Ÿ Something went wrong')
            print(r.text)

# tell it what to watch
l = watch_log.LogWatcher(config['cloudlog']['filepath'], pushContact)
# start the watching
l.loop()

I've used a config file, which looks like this


[cloudlog]
host = https://yourlog.server
key = yourkeyhere
filepath = /home/pi/.local/share/WSJT-X

I needed to change line 29 of `watch_log.py` to monitor `.adi` files, not just `.log`:


def __init__(self, folder, callback, extensions=["log"], tail_lines=0):

def __init__(self, folder, callback, extensions=["adi"], tail_lines=0):

Conclusion


I'm sure there are better ways of doing this, but it was quick, simple, and it works.


Sure, I have to remember to start the script first, but it's not too big of an issue, and I *could* make it start automatically on boot...


It would be nice to show on the CLI some info about the contact, e.g. `๐Ÿ˜ƒ contact with G5BK created!`, but that would require parsing the adi text and it's just not that important to me (for now.)


-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-

๐Ÿ–ค Black Lives Matter

๐Ÿ’™๐Ÿค๐Ÿ’œ Trans Rights are Human Rights

โค๏ธ๐Ÿงก๐Ÿ’›๐Ÿ’š๐Ÿ’™๐Ÿ’œ Love is Love


Copyright ยฉ 2024 Christopher M0YNG - It is forbidden to use any part of this site for crypto/NFT/AI related projects.

Code snippets are licenced under the Hippocratic License 3.0 (or later.)

Page generated 2024-03-24 by Complex 19

-- Response ended

-- Page fetched on Sat May 18 21:23:43 2024