diff --git a/__pycache__/iconSelector.cpython-310.pyc b/__pycache__/iconSelector.cpython-310.pyc new file mode 100644 index 0000000..2c6d965 Binary files /dev/null and b/__pycache__/iconSelector.cpython-310.pyc differ diff --git a/iconSelector.py b/iconSelector.py index d970f94..d13231f 100644 --- a/iconSelector.py +++ b/iconSelector.py @@ -1,9 +1,9 @@ from pathlib import Path, PurePosixPath import os -currentDirectory = os.getcwd() -currentDirHC = "/home/nclanceman/tools/weather" +# currentDirectory = os.getcwd() +# currentDirectory = "/home/nclanceman/tools/weather" -# currentDirectory = PurePosixPath(Path.cwd()) +currentDirectory = PurePosixPath(Path.cwd()) adjectives = ["severe", "scattered", "partly", "mostly", "light", "heavy"] clearWords = ["clear", "sunny"] diff --git a/readme.md b/readme.md index 86b58bc..282dffe 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ 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 STATIONNAME +- Run test.sh from XFCE genMon as path/to/script/test.sh STATIONAME Without a station name, the script will report the weather at Hartsfield-Jackson International Airport in Atlanta, GA. diff --git a/weather.py b/weather.py index 33686c1..526e7e2 100644 --- a/weather.py +++ b/weather.py @@ -97,9 +97,13 @@ else: roundedTemp = rounding(temp) condition = request_json["properties"]["textDescription"] parsedCondition = iconSelect.parseDescription(condition) - timeOfDay = request_json['properties']['icon'].split("/")[5] + + if not (request_json['properties']['icon']): + timeOfDay = "day" + else: + timeOfDay = request_json['properties']['icon'].split("/")[5] weatherIcon = iconSelect.imageSelector(parsedCondition, timeOfDay) # print(f" \u2601 {condition}, {roundedTemp} F") print( - f"{weatherIcon}{roundedTemp}F") + f"{weatherIcon} {roundedTemp}F") print(tooltipPrinter(request_json)) diff --git a/weather.sh b/weather.sh new file mode 100755 index 0000000..63f76dd --- /dev/null +++ b/weather.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd "$(dirname "$0")" +SCRIPT_DIR="$(pwd)" +python3 $SCRIPT_DIR/weather.py $1