๐Ÿ’พ Archived View for m0yng.uk โ€บ 2021 โ€บ 08 โ€บ Printing-my-eQSLs captured on 2023-07-22 at 16:26:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2023-05-24)

โžก๏ธ Next capture (2023-09-08)

๐Ÿšง View Differences

-=-=-=-=-=-=-

Printing my eQSLs - M0YNG.uk

Created 2021-08-05

Tagged

eQSL is a cool idea, I have some reservations about it (most useful features are paid for, control over cards is limited, card size is small, the site is clunky) but it provides all the thrill of QSL cards without the delay ... or something.

Anyway, I can see my cards in cloudlog, which is great, but there isn't an easy way to just **browse** the cards (that I know of) or get a copy of them. When you view the cards in the eQSL website there is an option to print them (which doesn't work when I tried) but all that does it show just the image, and it is all very manual and labour intensive with lots of clicks.

I had a rummage around and found an old python script to download the card images (eqsl-downloader-python[1]) but couldn't get it working, I think some of the URLs have changed. CloudLog can fetch the cards too, so by mixing up the code from both I was able to hack together a script that would download the cards and send them off to my thermal printer. Some time later, I'd run out of paper and only done half of the QSL cards!

1: https://github.com/tasanakorn/eqsl-downloader-python

two reels of paper, one unwrapped to show eQSL cards in black and white [IMG]

You could obviously just use the script to download all your eQSL cards, but then they still only exist as data on your computer and not on a long reel of paper!

The eQSL "API"

eQSL doesn't have a proper API for getting cards, there are the following steps:

1. Call a URL with your username and password as query parameters

2. Get an HTML page with a link to the ADI or TXT file of your log

3. Download the log file

4. Parse the log

5. For each log entry call a url with the QSO's date year, date month, date day, time hour, time minute, mode, band, and remote call (oh, and your username and password)

6. Get an HTML page with a link to the image

7. Download the image

Printing the cards

This was fairly simple, Adafruit have a nice library for the printer that can handle printing suitably sized images so all I needed to do was rotate the file to better fit the paper and resize it (which wasn't actually needed, because the cards are such low resolution already!)

You may not want to rotate the image, as you can see here the card from E7TT is still readable and takes up much less space than the full size card from OH5BM.

E7TT and OH5BM cards printed onto paper [IMG]

You will also notice that many of the cards don't look great, obviously a thermal printer designed for text doesn't handle images with lots of colour and detail very well. Plus, I vastly overestimates the paper I had available / underestimated how many cards and how much paper they would need!

two strips of paper showing cards from EAGLE OM5XX F1RUM F4GUK S53AK [IMG]

The script

This is far from clean code, but it does work, for me at least.

import requests
import re
import adif_io
import os
# you can cut these two if you don't want to print them out
from Adafruit_Thermal import *
from PIL import Image

BASE_URL = 'http://www.eqsl.cc'
baseURL = 'https://www.eQSL.cc/qslcard/DownloadInBox.cfm?'
username = ''
password = ''

# you can cut this bit if you don't want to print them out
printer = Adafruit_Thermal("/dev/ttyUSB0", 19200, timeout=5)

eqslPageURI = baseURL + 'UserName=' + username + '&Password=' + urllib.parse.quote(password)
eqslPage = requests.get(eqslPageURI)
adiURI = re.search('<A HREF="(.*)">.ADI file</A>', eqslPage.text)

adiData = requests.get('https://eQSL.cc/qslcard/'+adiURI.group(1))

qsos, header =  adif_io.read_from_string(adiData.text)

for qso in qsos:
    outputFile = 'cards/' + qso['QSO_DATE'] + '-' + qso['TIME_ON'] + '-' + qso['BAND'] + '-' + qso['MODE'] + '-' + qso['CALL'].replace('/','-') + ".png"
    print(qso)
    if (not os.path.isfile(outputFile)) :
        card_url = 'https://www.eqsl.cc/qslcard/GeteQSL.cfm?Callsign=' + qso['CALL'] + '&CallsignFrom=' + qso['CALL'] + '&QSOYear=' + qso['QSO_DATE'][0:4] + '&QSOMonth=' + qso['QSO_DATE'][4:6] + '&QSODay=' + qso['QSO_DATE'][6:8] + '&QSOHour=' + qso['TIME_ON'][0:2] + '&QSOMinute=' + qso['TIME_ON'][2:4] + '&QSOBand=' + qso['BAND'] + '&QSOMode=' + qso['MODE'] + '&UserName=' + username + '&Password=' + urllib.parse.quote(password)
        cardPage = requests.get(card_url)
        cardImageURL = re.search(' src="/CFFileServlet/_cf_image/([a-zA-Z0-9_\-.]*)"',cardPage.text).group(1)
        print(cardImageURL)
        with requests.get('https://www.eQSL.cc/CFFileServlet/_cf_image/' + cardImageURL, stream = True) as incoming:
            with open(outputFile, 'wb') as outgoing:
                for chunk in incoming.iter_content(chunk_size=16*1024):
                    outgoing.write(chunk)
        # you can cut this to the end if you don't want to print them out
        image = Image.open(outputFile)
        image = image.rotate(90, expand=True) # only if you want them bigger
        image.thumbnail([384,100000])
        image.save(outputFile+'-thermal.png')
        printer.printImage(outputFile+'-thermal.png')

Conclusion?

This is almost certainly pointless and a waste of paper, BUT it is a fun wa to review past contacts in a tactile way (I only keep electronic logs) and it is cool to see SWL reports too which I don't get any other way (that I know of...)

I'm sure there are things I could do to enhance the quality of the prints, probably by some sort of processing of the image before but I'm not sure exactly what that would be.

I'm also unsure what to do with the tens of meters of printed out QSL cards I now have, maybe decorate the shack somehow?

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

๐Ÿ–ค Black Lives Matter

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

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

Copyright ยฉ 2023 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 2023-07-16 by Complex 19