1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-06-02 07:20:47 +00:00

Drop unimplemented weather code.

The weather code is just stubs at the moment, so I'm dropping it as it
adds no value.
This commit is contained in:
Brenden Matthews 2022-10-12 11:44:59 -05:00 committed by Brenden Matthews
parent f39b9720d2
commit 25e6598c90
10 changed files with 25 additions and 237 deletions

View File

@ -238,11 +238,6 @@ option(BUILD_CURL "Enable if you want Curl support" false)
option(BUILD_RSS "Enable if you want RSS support" false)
option(BUILD_WEATHER_METAR "Enable METAR weather support" true)
if(BUILD_WEATHER_METAR OR BUILD_RSS)
set(BUILD_CURL true)
endif(BUILD_WEATHER_METAR OR BUILD_RSS)
option(BUILD_APCUPSD "Enable APCUPSD support" true)
option(BUILD_ICAL "Enable if you want iCalendar (RFC 5545) support" false)

View File

@ -424,11 +424,6 @@ if(BUILD_RSS)
set(WANT_LIBXML2 true)
endif(BUILD_RSS)
if(BUILD_WEATHER_METAR)
set(WANT_CURL true)
set(BUILD_WEATHER true)
endif(BUILD_WEATHER_METAR)
if(BUILD_NVIDIA)
find_path(XNVCtrl_INCLUDE_PATH NVCtrl/NVCtrl.h ${INCLUDE_SEARCH_PATH})
find_library(XNVCtrl_LIB NAMES XNVCtrl)

View File

@ -80,8 +80,6 @@
#cmakedefine BUILD_CURL 1
#cmakedefine BUILD_WEATHER_METAR 1
#cmakedefine BUILD_IMLIB2 1
#cmakedefine BUILD_MATH 1

View File

@ -24,7 +24,7 @@ desc: |-
threads while Conky is running. For example, if you use an MPD variable,
the MPD thread will keep running until Conky dies. Some threaded objects
will use one of the parameters as a `key`, so that you only have 1
relevant thread running (for example, the $curl, $rss and $weather
relevant thread running (for example, the $curl, and $rss
objects launch one thread per URI).
Optional arguments are generally denoted with paretheses (i.e., `(optional)`).
@ -2369,116 +2369,6 @@ values:
default: 1
args:
- (n)
- name: weather
desc: |-
This feature is currently unimplemented.
Download, parse and display METAR data.
\'URI\' must be a valid METAR URI.
http://tgftp.nws.noaa.gov/data/observations/metar/stations/
\'locID\' must be a valid location identifier for the required uri. For
the NOAA site this must be a valid ICAO (see for instance
*https://pilotweb.nas.faa.gov/qryhtml/icao/*). For the weather.com site
this must be a valid location ID (see for instance
*http://aspnetresources.com/tools/locid.aspx*).
\'data_type\' must be one of the following:
**last_update** The date and time stamp of the data. The result depends
on the URI used. For the NOAA site it is date (yyyy/mm/dd) and UTC time.
For the weather.com one it is date (\[m\]m/\[d\]d/yy) and Local Time of
the station.\
**temperature**
Air temperature (you can use the \'temperature_unit\' config setting to
change units)\
**cloud_cover**
The highest cloud cover status\
**pressure**
Air pressure in millibar\
**wind_speed**
Wind speed in km/h\
**wind_dir**
Wind direction\
**wind_dir_DEG**
Compass wind direction\
**humidity**
Relative humidity in %\
**weather**
Any relevant weather event (rain, snow, etc.). This is not used if you
are querying the weather.com site since this data is aggregated into the
cloud_cover one\
**icon**
Weather icon (only for www.weather.com). Can be used together with the
icon kit provided upon registering to their service.
\'delay_in_minutes\' (optional, default 30) cannot be less than 30
minutes.
This object is threaded, and once a thread is created it can\'t be
explicitly destroyed. One thread will run for each URI specified.
Note that these variables are still EXPERIMENTAL and can be subject to
many future changes.
args:
- URI
- locID
- data_type
- (interval_in_minutes)
- name: weather_forecast
desc: |-
This feature is currently unimplemented.
Download, parse and display weather forecast data for a given day
(daytime only).
\'locID\', see \'weather\' above.
\'day\' is a number from 0 (today) to 4 (3 days after tomorrow).
\'data_type\' must be one of the following:
**day** **Day of the week**\
**date** **Date, in the form MMM DD (ie. Jul 14)**\
**low** **Minimum temperature (you can use the** \'temperature_unit\'
config setting to change units)\
**hi** **Maximum temperature (you can use the** \'temperature_unit\'
config setting to change units)\
**icon** **Weather icon. Can be used together with the icon** kit
provided upon registering to the weather.com service\
**forecast** **Weather forecast (sunny, rainy, etc.)**\
**wind_speed** **Wind speed in km/h**\
**wind_dir** **Wind direction**\
**wind_dir_DEG** **Compass wind direction**\
**humidity** **Relative humidity in %**\
**precipitation** **Probability of having a precipitation (in** %)
\'delay_in_minutes\' (optional, default 210) cannot be lower than 210
min.
This object is threaded, and once a thread is created it can\'t be
explicitly destroyed. One thread will run for each URI specified. You
can use any protocol that Curl supports.
Note that these variables are still EXPERIMENTAL and can be subject to
many future changes.
args:
- URI
- locID
- day
- data_type
- (interval_in_minutes)
- name: wireless_ap
desc: Wireless access point MAC address. Linux only.
args:

View File

@ -254,11 +254,6 @@ if(BUILD_RSS)
set(optional_sources ${optional_sources} ${rss})
endif(BUILD_RSS)
if(BUILD_WEATHER)
set(weather weather.cc weather.h)
set(optional_sources ${optional_sources} ${weather})
endif(BUILD_WEATHER)
if(BUILD_NVIDIA)
set(nvidia nvidia.cc nvidia.h)
set(optional_sources ${optional_sources} ${nvidia})

View File

@ -114,9 +114,6 @@
#ifdef BUILD_CURL
#include "ccurl_thread.h"
#endif /* BUILD_CURL */
#ifdef BUILD_WEATHER_METAR
#include "weather.h"
#endif /* BUILD_WEATHER_METAR */
#include "display-output.hh"
#include "lua-config.hh"

View File

@ -89,9 +89,6 @@
#ifdef BUILD_CURL
#include "ccurl_thread.h"
#endif /* BUILD_CURL */
#ifdef BUILD_WEATHER_METAR
#include "weather.h"
#endif /* BUILD_WEATHER_METAR */
#ifdef BUILD_RSS
#include "rss.h"
#endif /* BUILD_RSS */
@ -434,7 +431,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
END OBJ(freq, nullptr) get_cpu_count();
if ((arg == nullptr) || strlen(arg) >= 3 ||
strtol(&arg[0], nullptr, 10) == 0 ||
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) > info.cpu_count) {
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) >
info.cpu_count) {
obj->data.i = 1;
/* NORM_ERR("freq: Invalid CPU number or you don't have that many CPUs! "
"Displaying the clock for CPU 1."); */
@ -445,7 +443,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
END OBJ(freq_g, nullptr) get_cpu_count();
if ((arg == nullptr) || strlen(arg) >= 3 ||
strtol(&arg[0], nullptr, 10) == 0 ||
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) > info.cpu_count) {
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) >
info.cpu_count) {
obj->data.i = 1;
/* NORM_ERR("freq_g: Invalid CPU number or you don't have that many "
"CPUs! Displaying the clock for CPU 1."); */
@ -457,7 +456,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
END OBJ(cpugovernor, nullptr) get_cpu_count();
if ((arg == nullptr) || strlen(arg) >= 3 ||
strtol(&arg[0], nullptr, 10) == 0 ||
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) > info.cpu_count) {
static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) >
info.cpu_count) {
obj->data.i = 1;
/* NORM_ERR("cpugovernor: Invalid CPU number or you don't have that "
"many CPUs! Displaying the scaling governor for CPU 1."); */
@ -484,7 +484,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
#if defined(__linux__)
END OBJ(voltage_mv, 0) get_cpu_count();
if (!arg || strlen(arg) >= 3 || strtol(&arg[0], nullptr, 10) == 0 ||
(unsigned int)strtol(&arg[0], nullptr, 10) > info.cpu_count) {
(unsigned int)strtol(&arg[0], nullptr, 10) > info.cpu_count) {
obj->data.i = 1;
/* NORM_ERR("voltage_mv: Invalid CPU number or you don't have that many "
"CPUs! Displaying voltage for CPU 1."); */
@ -494,7 +494,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
obj->callbacks.print = &print_voltage_mv;
END OBJ(voltage_v, 0) get_cpu_count();
if (!arg || strlen(arg) >= 3 || strtol(&arg[0], nullptr, 10) == 0 ||
(unsigned int)strtol(&arg[0], nullptr, 10) > info.cpu_count) {
(unsigned int)strtol(&arg[0], nullptr, 10) > info.cpu_count) {
obj->data.i = 1;
/* NORM_ERR("voltage_v: Invalid CPU number or you don't have that many "
"CPUs! Displaying voltage for CPU 1."); */
@ -596,7 +596,6 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
obj->data.s = strndup(bat, text_buffer_size.get(*state));
obj->callbacks.print = &battery_power_draw;
obj->callbacks.free = &gen_free_opaque;
END OBJ(battery_bar, nullptr) char bat[64];
@ -659,12 +658,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
EQUAL) {
obj->data.i = PB_BATT_STATUS;
}
else if (strcmp(arg, "percent") == EQUAL) {
obj->data.i = PB_BATT_PERCENT;
}
else if (strcmp(arg, "time") == EQUAL) {
obj->data.i = PB_BATT_TIME;
}
else if (strcmp(arg, "percent") == EQUAL) { obj->data.i = PB_BATT_PERCENT; }
else if (strcmp(arg, "time") == EQUAL) { obj->data.i = PB_BATT_TIME; }
else {
NORM_ERR("pb_battery: illegal argument '%s', defaulting to status", arg);
obj->data.i = PB_BATT_STATUS;
@ -1029,20 +1024,24 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
END OBJ(fs_used, &update_fs_stats) init_fs(obj, arg);
obj->callbacks.print = &print_fs_used;
#ifdef BUILD_GUI
END OBJ(hr, nullptr) obj->data.l = arg != nullptr ? strtol(arg, nullptr, 10) : 1;
END OBJ(hr, nullptr) obj->data.l =
arg != nullptr ? strtol(arg, nullptr, 10) : 1;
obj->callbacks.print = &new_hr;
#endif /* BUILD_GUI */
END OBJ(nameserver, &update_dns_data) parse_nameserver_arg(obj, arg);
obj->callbacks.print = &print_nameserver;
obj->callbacks.free = &free_dns_data;
END OBJ(offset, nullptr) obj->data.l = arg != nullptr ? strtol(arg, nullptr, 10) : 1;
END OBJ(offset, nullptr) obj->data.l =
arg != nullptr ? strtol(arg, nullptr, 10) : 1;
obj->callbacks.print = &new_offset;
END OBJ(voffset, nullptr) obj->data.l = arg != nullptr ? strtol(arg, nullptr, 10) : 1;
END OBJ(voffset, nullptr) obj->data.l =
arg != nullptr ? strtol(arg, nullptr, 10) : 1;
obj->callbacks.print = &new_voffset;
END OBJ(save_coordinates, nullptr) obj->data.l =
arg != nullptr ? strtol(arg, nullptr, 10) : 0;
obj->callbacks.print = &new_save_coordinates;
END OBJ_ARG(goto, nullptr, "goto needs arguments") obj->data.l = strtol(arg, nullptr, 10);
END OBJ_ARG(goto, nullptr, "goto needs arguments") obj->data.l =
strtol(arg, nullptr, 10);
obj->callbacks.print = &new_goto;
#ifdef BUILD_GUI
END OBJ(tab, nullptr) scan_tab(obj, arg);
@ -1505,7 +1504,8 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
parse_net_stat_arg(obj, arg, free_at_crash);
obj->callbacks.print = &print_totalup;
END OBJ(updates, nullptr) obj->callbacks.print = &print_updates;
END OBJ_IF(if_updatenr, nullptr) obj->data.i = arg != nullptr ? strtol(arg, nullptr, 10) : 0;
END OBJ_IF(if_updatenr, nullptr) obj->data.i =
arg != nullptr ? strtol(arg, nullptr, 10) : 0;
if (obj->data.i == 0) {
CRIT_ERR(obj, free_at_crash,
"if_updatenr needs a number above 0 as argument");
@ -1513,9 +1513,11 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
set_updatereset(obj->data.i > get_updatereset() ? obj->data.i
: get_updatereset());
obj->callbacks.iftest = &updatenr_iftest;
END OBJ(alignr, nullptr) obj->data.l = arg != nullptr ? strtol(arg, nullptr, 10) : 1;
END OBJ(alignr, nullptr) obj->data.l =
arg != nullptr ? strtol(arg, nullptr, 10) : 1;
obj->callbacks.print = &new_alignr;
END OBJ(alignc, nullptr) obj->data.l = arg != nullptr ? strtol(arg, nullptr, 10) : 0;
END OBJ(alignc, nullptr) obj->data.l =
arg != nullptr ? strtol(arg, nullptr, 10) : 0;
obj->callbacks.print = &new_alignc;
END OBJ(upspeed, &update_net_stats)
parse_net_stat_arg(obj, arg, free_at_crash);
@ -1789,10 +1791,6 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
obj->callbacks.print = &rss_print_info;
obj->callbacks.free = &rss_free_obj_info;
#endif /* BUILD_RSS */
#ifdef BUILD_WEATHER_METAR
END OBJ_ARG(weather, 0, "weather still needs to written...")
obj->callbacks.print = &print_weather;
#endif /* BUILD_WEATHER_METAR */
END OBJ_ARG(lua, nullptr,
"lua needs arguments: <function name> [function parameters]")
obj->data.s = STRNDUP_ARG;

View File

@ -101,9 +101,6 @@ static void print_version() {
#ifdef BUILD_MYSQL
<< _(" * MySQL\n")
#endif /* BUILD_MYSQL */
#ifdef BUILD_WEATHER_METAR
<< _(" * Weather (METAR)\n")
#endif /* BUILD_WEATHER_METAR */
#ifdef BUILD_WLAN
<< _(" * wireless\n")
#endif /* BUILD_WLAN */

View File

@ -1,42 +0,0 @@
/*
*
* Conky, a system monitor, based on torsmo
*
* Please see COPYING for details
*
* Copyright (c) 2005-2021 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "weather.h"
#include <ctype.h>
#include <time.h>
#include <array>
#include <cmath>
#include <mutex>
#include <string>
#include "ccurl_thread.h"
#include "config.h"
#include "conky.h"
#include "logging.h"
#include "temphelper.h"
#include "text_object.h"
void print_weather(struct text_object *obj, char *p, unsigned int p_max_size) {
(void)obj;
strncpy(p, "TODO...", p_max_size);
}

View File

@ -1,35 +0,0 @@
/*
*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2021 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef WEATHER_H_
#define WEATHER_H_
void print_weather(struct text_object *, char *, unsigned int);
#endif /* WEATHER_H_ */