diff --git a/__pycache__/iconSelector.cpython-311.pyc b/__pycache__/iconSelector.cpython-311.pyc
new file mode 100644
index 0000000..a00097b
Binary files /dev/null and b/__pycache__/iconSelector.cpython-311.pyc differ
diff --git a/iconSelector.py b/iconSelector.py
index b9e4b87..d970f94 100644
--- a/iconSelector.py
+++ b/iconSelector.py
@@ -1,3 +1,10 @@
+from pathlib import Path, PurePosixPath
+import os
+currentDirectory = os.getcwd()
+currentDirHC = "/home/nclanceman/tools/weather"
+
+# currentDirectory = PurePosixPath(Path.cwd())
+
adjectives = ["severe", "scattered", "partly", "mostly", "light", "heavy"]
clearWords = ["clear", "sunny"]
rainWords = ["rain", "showers"]
@@ -35,22 +42,35 @@ def parseDescription(desc):
def imageSelector(desc, timeOfDay):
+ result = ""
+
match desc:
case "clear":
if timeOfDay == "day":
- return "/smallIcons/clear-day-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'clear-day-small.png')
else:
- return "/smallIcons/clear-night-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'clear-night-small.png')
case "cloudy":
if timeOfDay == "day":
- return "/smallIcons/overcast-day-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'overcast-day-small.png')
else:
- return "/smallIcons/overcast-night-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'overcast-night-small.png')
case "wind":
- return "/smallIcons/wind-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'wind-small.png')
case "thunderstorm":
- return "/smallIcons/thunderstorms-rain-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'thunderstorms-rain-small.png')
+
case "rain":
- return "/smallIcons/rain-small.png"
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'rain-small.png')
+ case _:
+ result = os.path.join(
+ currentDirectory, 'smallIcons', 'code-red-small.png')
- return "/smallIcons/code-red-small.png"
+ return result
diff --git a/weather.py b/weather.py
index 71dbc71..33686c1 100644
--- a/weather.py
+++ b/weather.py
@@ -2,10 +2,8 @@ import requests
import math
import sys
import iconSelector as iconSelect
-import os
-currentDirectory = os.getcwd()
-CDHardcode = "/home/nclanceman/tools/weather"
+weatherIcon = ""
try:
stationName = sys.argv[1]
@@ -98,11 +96,10 @@ else:
temp = convertToF(request_json["properties"]["temperature"]["value"])
roundedTemp = rounding(temp)
condition = request_json["properties"]["textDescription"]
+ parsedCondition = iconSelect.parseDescription(condition)
timeOfDay = request_json['properties']['icon'].split("/")[5]
- weatherIcon = iconSelect.parseDescription(condition)
- weatherIconImage = currentDirectory +\
- iconSelect.imageSelector(weatherIcon, timeOfDay)
+ weatherIcon = iconSelect.imageSelector(parsedCondition, timeOfDay)
# print(f" \u2601 {condition}, {roundedTemp} F")
print(
- f"
{weatherIconImage} {roundedTemp}F")
+ f"
{weatherIcon}{roundedTemp}F")
print(tooltipPrinter(request_json))