ansiweather

Weather in terminal, with ANSI colors and Unicode symbols
Log | Files | Refs | README | LICENSE

commit 2fd388df28f5df4ce0247bdd6b542c291fcae851
parent 414c5d86f6e2148863b3a96c854e4f40c97c037c
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Thu, 29 Oct 2015 12:05:51 +0100

Removing the auto location helper, user location must now be explicitly set

Diffstat:
MREADME.md | 12+-----------
Mansiweather | 29+----------------------------
Mansiweatherrc.example | 4----
3 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/README.md b/README.md @@ -89,8 +89,6 @@ Example : `~/.ansiweatherrc` api_key:X1234567890 location:Moscow,RU fetch_cmd:ftp -V -o - - geo_api_url:www.telize.com/geoip - geo_api_proto:http units:metric daylight:true @@ -101,8 +99,7 @@ The file `ansiweatherrc.example` contains all available configuration variables. Location format is `city,CC` where `CC` is a two-letter ISO 3166-1 alpha-2 country code. A list of country codes is available [here](http://www.statdns.com/cctlds/). Alternatively, it's also possible to specify locations by their ID, a city list is available [here](http://openweathermap.org/help/city_list.txt). -In case no location is specified, AnsiWeather will try to geolocate you -using [Telize](http://www.telize.com/). +In case no location is specified, AnsiWeather will fallback to the default location. Example : `Moscow,RU` @@ -174,14 +171,7 @@ Default : `%a %b %d` Default : `%b %d %r` -### GeoIP URL -Set the URL for getting GeoIP data (must return JSON) : - - geo_api_url:www.telize.com/geoip - geo_api_proto:http - -Default : `http://www.telize.com/geoip` ## License diff --git a/ansiweather b/ansiweather @@ -108,40 +108,13 @@ fi -###[ Auto-Location Logic ]##################################################### - -geo_api_proto=$(get_config "geo_api_proto" || echo "http") -geo_api_url=$(get_config "geo_api_url" || echo "www.telize.com/geoip") #geo location service -geo_api="${geo_api_proto}://${geo_api_url}" - -auto_locate() { - ret="" - - geo_data=$($fetch_cmd "$geo_api") - - city=$(echo "$geo_data" | jq -r '.city') - - country=$(echo "$geo_data" | jq -r '.country_code') - - ret=$city,$country - - if [ "$ret" = "," ] - then - return 1 - else - echo "$ret" - fi -} - - - ###[ Set options that are not set from command line ]########################## # OpenWeatherMap API key [ -z "$api_key" ] && api_key=$(get_config "api_key" || echo "85a4e3c55b73909f42c6a23ec35b7147") # Location : example "Moscow,RU" -[ -z "$location" ] && location=$(get_config "location" || auto_locate || echo "Moscow,RU") +[ -z "$location" ] && location=$(get_config "location" || echo "Moscow,RU") # System of Units : "metric" or "imperial" [ -z "$units" ] && units=$(get_config "units" || echo "metric") diff --git a/ansiweatherrc.example b/ansiweatherrc.example @@ -10,10 +10,6 @@ symbols:true dateformat:%a %b %d timeformat:%b %d %r -# Geolocation -geo_api_proto:http -geo_api_url:www.telize.com/geoip - # Text and Colors background:\033[44m text:\033[36;1m