about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-08-04 14:54:19 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-08-04 14:54:19 +0200
commite1e97ee5c265d47c40f385a625591e68a11f5341 (patch)
treeda994eb44984c94e5575677287ae0a0b07ba26e1
parentAdded ethernet icon dwm-status (diff)
downloaddwm-e1e97ee5c265d47c40f385a625591e68a11f5341.tar.gz
dwm-e1e97ee5c265d47c40f385a625591e68a11f5341.tar.bz2
dwm-e1e97ee5c265d47c40f385a625591e68a11f5341.zip
Changed location getting in weather.py from geolocate cmd
-rw-r--r--scripts/weather.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/weather.py b/scripts/weather.py
index 1f4bfba..f6be64a 100644
--- a/scripts/weather.py
+++ b/scripts/weather.py
@@ -14,8 +14,8 @@ try:
 except requests.ConnectionError:
     internet = False
 
-COORDINATES = open("/usr/share/geolocate/.location", 'r').read()
-LOCATION = "lat=" + COORDINATES.replace(":","&lon=")
+#COORDINATES = open("/usr/share/geolocate/.location", 'r').read()
+#LOCATION = "lat=" + COORDINATES.replace(":","&lon=")
 
 API_KEY = "756edce7e9d4c385ef9499a53492678c"
 UNITS = "Metric"
@@ -25,6 +25,9 @@ LANG = "en"
 #LANG = "nl"
 #LANG = "hu"
 if internet == True:
+    COORDINATES = os.popen("geolocate").read()
+    LOCATION = "lat=" + COORDINATES.replace(":","&lon=")
+
     API="http://api.openweathermap.org/data/2.5/weather?{}&lang={}&appid={}&units={}".format(LOCATION.strip(), LANG,  API_KEY, UNITS)
     REQ = requests.get(API)
     #REQ = requests.get("http://api.openweathermap.org/data/2.5/weather?lat=50.84660&lon=4.35280&lang=en&appid=756edce7e9d4c385ef9499a53492678c&units=Metric")