libmateweather: update default server uri.

This commit is contained in:
Luis Guzmán 2025-09-20 21:47:31 -06:00
parent 9dbf1c0566
commit 332c457286
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,38 @@
From 4e54f44dab4efa8c216b26ea7188b99c94882ba4 Mon Sep 17 00:00:00 2001
From: Victor Kareh <vkareh@redhat.com>
Date: Thu, 18 Sep 2025 11:40:55 -0400
Subject: [PATCH] metar: Update AviationWeather URL
According to their website: "The AviationWeather Data API has been
redeveloped in 2025."
Also they put 'METAR' (or 'SPECI') onto the beginning of data to make it
ICAO compliant, so we add code to parse that.
Fixes #135
---
libmateweather/weather-metar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmateweather/weather-metar.c b/libmateweather/weather-metar.c
index 7bc24fc9..4698a077 100644
--- a/libmateweather/weather-metar.c
+++ b/libmateweather/weather-metar.c
@@ -510,7 +510,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
loc = info->location;
- searchkey = g_strdup_printf ("<raw_text>%s", loc->code);
+ searchkey = g_strdup_printf ("<raw_text>METAR %s", loc->code);
p = strstr (msg->response_body->data, searchkey);
g_free (searchkey);
if (p) {
@@ -550,7 +550,7 @@ metar_start_open (WeatherInfo *info)
}
msg = soup_form_request_new (
- "GET", "https://aviationweather.gov/cgi-bin/data/dataserver.php",
+ "GET", "https://aviationweather.gov/api/data/dataserver",
"dataSource", "metars",
"requestType", "retrieve",
"format", "xml",

View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2025 Luis Guzmán <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
VERSION=1
. ./config
apply_patch_changes
changelog "Fix dataserver weather url change."
package