Panduan langkah demi langkah menyambungkan WSJT-X ke Buku Log QSO Hamfinity.
Sistem ini berfungsi dengan memantau fail log di komputer anda. Setiap kali anda klik "Log QSO" di perisian FT8, perisian kecil ini akan menghantarnya terus ke portal ini secara langsung. Ikuti 7 langkah mudah ini dengan teliti.
cmd, dan tekan Enter. Satu tetingkap hitam (Command Prompt) akan terbuka.wsjtx_log.adi di dalamnya.Di bahagian atas kod dalam Notepad tadi, cari bahagian CONFIGURATION. Anda perlu ubah 3 perkara penting:
" "."YOUR_CALLSIGN_HERE" dengan Callsign sebenar anda (Contoh: "9M8ZAL").\wsjtx_log.adi di hujung laluan tersebut, dan biarkan huruf r kecil di hadapannya.
cmd, tekan Enter).Selagi tetingkap hitam itu tertulis "QSO Hamfinity Live Bridge Started" dan dibiarkan terbuka, ia sedang bekerja. Cuba buat satu QSO di WSJT-X. Apabila anda tekan "Log QSO", tetingkap hitam itu akan memaparkan perkataan ✅ Success. Anda kini boleh menyemak buku log peribadi di portal QSO Hamfinity!
Salin semua baris kod di dalam kotak gelap ini dan tampal (paste) ke dalam fail ft8_live_bridge.py anda seperti yang diterangkan di Langkah 4.
import time
import os
import re
import requests
# ==========================================
# ⚙️ CONFIGURATION - CHANGE THESE 3 THINGS!
# ==========================================
# 1. The exact URL to your new API file
API_URL = "https://qso.hamfinity.com/dashboard/api_live_log.php"
# 2. Must match the secret key provided by the Admin
API_KEY = "QSOHamfinity_Live_Secret!"
# 3. Your callsign (to tell the database whose logbook to put it in)
MY_CALLSIGN = "YOUR_CALLSIGN_HERE"
# The location of your WSJT-X ADIF log file.
WSJTX_LOG_PATH = r"C:\Users\YOUR_PC_NAME\AppData\Local\WSJT-X\wsjtx_log.adi"
# ==========================================
def parse_adif_record(record_string):
"""Extracts data from a single ADIF string."""
data = {}
tags = ['call', 'band', 'mode', 'freq', 'rst_sent', 'rst_rcvd', 'qso_date', 'time_on', 'gridsquare']
for tag in tags:
match = re.search(rf'<{tag}:\d+[^>]*>([^<\s]+)', record_string, re.IGNORECASE)
if match:
data[tag] = match.group(1).strip()
return data
def send_to_portal(qso_data):
"""Sends the extracted QSO to the QSO Hamfinity PHP API."""
date_str = qso_data.get('qso_date', '')
if len(date_str) == 8:
date_str = f"{date_str[0:4]}-{date_str[4:6]}-{date_str[6:8]}"
time_str = qso_data.get('time_on', '')
if len(time_str) >= 4:
time_str = f"{time_str[0:2]}:{time_str[2:4]}:{time_str[4:6] if len(time_str)>=6 else '00'}"
payload = {
'api_key': API_KEY,
'owner_callsign': MY_CALLSIGN,
'qso_call': qso_data.get('call', ''),
'band': qso_data.get('band', ''),
'mode': qso_data.get('mode', 'FT8'),
'freq': qso_data.get('freq', ''),
'grid': qso_data.get('gridsquare', ''),
'rst_sent': qso_data.get('rst_sent', ''),
'rst_rcvd': qso_data.get('rst_rcvd', ''),
'qso_date': date_str,
'qso_time': time_str
}
try:
print(f"📡 Sending {payload['qso_call']} to QSO Hamfinity Portal...")
response = requests.post(API_URL, data=payload)
if response.status_code == 200:
print(f"✅ Success: {response.text}\n")
else:
print(f"❌ Error {response.status_code}: {response.text}\n")
except Exception as e:
print(f"⚠️ Connection Failed: {e}\n")
def watch_log_file():
"""Watches the WSJT-X log file