Browse Source

portable code

master
NCLanceman 5 months ago
parent
commit
7218fabad6
  1. BIN
      __pycache__/iconSelector.cpython-310.pyc
  2. 6
      iconSelector.py
  3. 2
      readme.md
  4. 4
      weather.py
  5. 4
      weather.sh

BIN
__pycache__/iconSelector.cpython-310.pyc

Binary file not shown.

6
iconSelector.py

@ -1,9 +1,9 @@
from pathlib import Path, PurePosixPath from pathlib import Path, PurePosixPath
import os import os
currentDirectory = os.getcwd() # currentDirectory = os.getcwd()
currentDirHC = "/home/nclanceman/tools/weather" # currentDirectory = "/home/nclanceman/tools/weather"
# currentDirectory = PurePosixPath(Path.cwd()) currentDirectory = PurePosixPath(Path.cwd())
adjectives = ["severe", "scattered", "partly", "mostly", "light", "heavy"] adjectives = ["severe", "scattered", "partly", "mostly", "light", "heavy"]
clearWords = ["clear", "sunny"] clearWords = ["clear", "sunny"]

2
readme.md

@ -4,7 +4,7 @@ For use in XFCE for monitoring weather from a given station using the National W
Instructions: Instructions:
- Download files - 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. Without a station name, the script will report the weather at Hartsfield-Jackson International Airport in Atlanta, GA.

4
weather.py

@ -97,6 +97,10 @@ else:
roundedTemp = rounding(temp) roundedTemp = rounding(temp)
condition = request_json["properties"]["textDescription"] condition = request_json["properties"]["textDescription"]
parsedCondition = iconSelect.parseDescription(condition) parsedCondition = iconSelect.parseDescription(condition)
if not (request_json['properties']['icon']):
timeOfDay = "day"
else:
timeOfDay = request_json['properties']['icon'].split("/")[5] timeOfDay = request_json['properties']['icon'].split("/")[5]
weatherIcon = iconSelect.imageSelector(parsedCondition, timeOfDay) weatherIcon = iconSelect.imageSelector(parsedCondition, timeOfDay)
# print(f"<txt> \u2601 {condition}, {roundedTemp} F</txt>") # print(f"<txt> \u2601 {condition}, {roundedTemp} F</txt>")

4
weather.sh

@ -0,0 +1,4 @@
#!/bin/bash
cd "$(dirname "$0")"
SCRIPT_DIR="$(pwd)"
python3 $SCRIPT_DIR/weather.py $1
Loading…
Cancel
Save