diff --git a/__pycache__/iconSelector.cpython-311.pyc b/__pycache__/iconSelector.cpython-311.pyc
new file mode 100644
index 0000000..2492939
Binary files /dev/null and b/__pycache__/iconSelector.cpython-311.pyc differ
diff --git a/iconSelector.py b/iconSelector.py
index 459aed9..8fe1b2a 100644
--- a/iconSelector.py
+++ b/iconSelector.py
@@ -8,7 +8,8 @@ windWords = ["wind", "windy", "gusts"]
def parseDescription(desc):
# Parse a weather description by returning the first
# "weather word" in a NWS description.
- parsed = desc.split(" ")
+ # parsed = ((desc.lower()).split("/")).split(" ")
+ parsed = ((desc.lower()).split(" "))
for i in parsed:
if i in adjectives:
@@ -30,14 +31,20 @@ def parseDescription(desc):
def imageSelector(desc, timeOfDay):
match desc:
case "Clear":
- return "./smallIcons/clear-day-small.png"
+ if timeOfDay == "day":
+ return "/smallIcons/clear-day-small.png"
+ else:
+ return "/smallIcons/clear-night-small.png"
case "Cloudy":
- return "./smallIcons/cloudy-small.png"
+ if timeOfDay == "day":
+ return "/smallIcons/overcast-day-small.png"
+ else:
+ return "/smallIcons/overcast-night-small.png"
case "Wind":
- return "./smallIcons/wind-small.png"
+ return "/smallIcons/wind-small.png"
case "Thunderstorm":
- return "./smallIcons/thunderstorms-day-small.png"
+ return "/smallIcons/thunderstorms-rain-small.png"
case "Rain":
- return "./smallIcons/rain-small.png"
+ return "/smallIcons/rain-small.png"
- return ""
+ return "/smallIcons/code-red-small.png"
diff --git a/readme.md b/readme.md
index e9c1516..86b58bc 100644
--- a/readme.md
+++ b/readme.md
@@ -4,6 +4,9 @@ For use in XFCE for monitoring weather from a given station using the National W
Instructions:
- Download files
-- Run weather.py from XFCE GenMon as path/to/script/weather.py -station STATIONNAME
+- Run weather.py from XFCE GenMon as path/to/script/weather.py STATIONNAME
Without a station name, the script will report the weather at Hartsfield-Jackson International Airport in Atlanta, GA.
+
+TODO: add zipcode as a proper arguement and find the nearest station for current observations.
+- Five Day Forecast in tooltip.
diff --git a/weather.py b/weather.py
index 179a43c..3156078 100644
--- a/weather.py
+++ b/weather.py
@@ -1,6 +1,7 @@
import requests
import math
import sys
+import iconSelector as iconSelect
try:
stationName = sys.argv[1]
@@ -87,7 +88,9 @@ else:
roundedTemp = rounding(temp)
condition = request_json["properties"]["textDescription"]
timeOfDay = request_json['properties']['icon'].split("/")[5]
+ weatherIcon = iconSelect.parseDescription(condition)
+ weatherIconImage = f"/home/nclanceman/tools/weather{iconSelect.imageSelector(weatherIcon, timeOfDay)}"
# print(f" \u2601 {condition}, {roundedTemp} F")
print(
- f"
/home/nclanceman/tools/weather/smallIcons/cloudy-small.png {condition}, {roundedTemp}F")
+ f"
{weatherIconImage} {condition}, {roundedTemp}F")
print(tooltipPrinter(request_json))