|
|
@ -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"] |
|
|
adjectives = ["severe", "scattered", "partly", "mostly", "light", "heavy"] |
|
|
clearWords = ["clear", "sunny"] |
|
|
clearWords = ["clear", "sunny"] |
|
|
rainWords = ["rain", "showers"] |
|
|
rainWords = ["rain", "showers"] |
|
|
@ -35,22 +42,35 @@ def parseDescription(desc): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def imageSelector(desc, timeOfDay): |
|
|
def imageSelector(desc, timeOfDay): |
|
|
|
|
|
result = "" |
|
|
|
|
|
|
|
|
match desc: |
|
|
match desc: |
|
|
case "clear": |
|
|
case "clear": |
|
|
if timeOfDay == "day": |
|
|
if timeOfDay == "day": |
|
|
return "/smallIcons/clear-day-small.png" |
|
|
result = os.path.join( |
|
|
|
|
|
currentDirectory, 'smallIcons', 'clear-day-small.png') |
|
|
else: |
|
|
else: |
|
|
return "/smallIcons/clear-night-small.png" |
|
|
result = os.path.join( |
|
|
|
|
|
currentDirectory, 'smallIcons', 'clear-night-small.png') |
|
|
case "cloudy": |
|
|
case "cloudy": |
|
|
if timeOfDay == "day": |
|
|
if timeOfDay == "day": |
|
|
return "/smallIcons/overcast-day-small.png" |
|
|
result = os.path.join( |
|
|
|
|
|
currentDirectory, 'smallIcons', 'overcast-day-small.png') |
|
|
else: |
|
|
else: |
|
|
return "/smallIcons/overcast-night-small.png" |
|
|
result = os.path.join( |
|
|
|
|
|
currentDirectory, 'smallIcons', 'overcast-night-small.png') |
|
|
case "wind": |
|
|
case "wind": |
|
|
return "/smallIcons/wind-small.png" |
|
|
result = os.path.join( |
|
|
|
|
|
currentDirectory, 'smallIcons', 'wind-small.png') |
|
|
case "thunderstorm": |
|
|
case "thunderstorm": |
|
|
return "/smallIcons/thunderstorms-rain-small.png" |
|
|
result = os.path.join( |
|
|
|
|
|
currentDirectory, 'smallIcons', 'thunderstorms-rain-small.png') |
|
|
|
|
|
|
|
|
case "rain": |
|
|
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 |
|
|
|