Skip to content

Commit e8fcc49

Browse files
authored
Merge pull request #91 from TheFinalJoke/add_nws
fixed nws
2 parents 2ce274f + 08d5417 commit e8fcc49

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/weather/weathergov/nws.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env python3
22
import asyncio
3+
import sys
4+
import json
5+
import datetime as dt
36
import lib.weather.weatherbase as base
47
from lib.weather.weather_icon import weather_icon_mapping
58
from lib.asynclib import make_async
@@ -22,7 +25,7 @@ async def parse_args(self) -> str:
2225
return await self.url_builder()
2326

2427

25-
async def get_long_and_lat(self, location: str=None, zipcode: int=None) -> Tuple:
28+
async def get_long_and_lat(self, location: str=None, zipcode: int=None, url=None) -> Tuple:
2629
"""
2730
Searches for Longitude and latitude for Given City
2831
"""
@@ -135,10 +138,10 @@ def __repr__(self) -> str:
135138
@property
136139
def get_icon(self):
137140
# Have to get the icon
138-
condition: int = self._weather[0]['shortForecast'].lower()
141+
condition: str = self._weather[0]['shortForecast'].lower()
139142
if any(s in condition.lower() for s in ("sunny", "clear", 'sun')):
140143
# Sunny
141-
if self._sunset > datetime.now():
144+
if self._sunset.replace(tzinfo=None) > datetime.now():
142145
owm_icon = weather_icon_mapping[0]
143146
else:
144147
owm_icon = weather_icon_mapping[48]
@@ -147,7 +150,7 @@ def get_icon(self):
147150
elif 'snow' in condition:
148151
owm_icon = weather_icon_mapping[13]
149152
elif any(s in condition.lower() for s in ('cloudy', 'cloud')):
150-
owm_icon = weather_icon_ampping[7]
153+
owm_icon = weather_icon_mapping[7]
151154
else:
152155
owm_icon = weather_icon_mapping[0]
153156
return owm_icon

matrix/weathermatrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def render_icon(self, api) -> None:
8585
color: Tuple[int] = (192, 192, 192)
8686
elif owm_wxcode == 800:
8787
# Sunny
88-
if api.get_sunset > datetime.now():
88+
if api.dayforcast.sunset.replace(tzinfo=None) > datetime.now():
8989
color: Tuple[int] = (220, 149, 3)
9090
else:
9191
color: Tuple[int] = (255,255,255)

0 commit comments

Comments
 (0)