mirror of
https://github.com/chubin/wttr.in.git
synced 2024-10-05 09:52:13 +02:00
commit
dd8626a50b
@ -147,6 +147,28 @@ WEATHER_SYMBOL_WI_NIGHT = {
|
||||
"VeryCloudy": "",
|
||||
}
|
||||
|
||||
WEATHER_SYMBOL_PLAIN = {
|
||||
"Unknown": "?",
|
||||
"Cloudy": "mm",
|
||||
"Fog": "=",
|
||||
"HeavyRain": "///",
|
||||
"HeavyShowers": "//",
|
||||
"HeavySnow": "**",
|
||||
"HeavySnowShowers": "*/*",
|
||||
"LightRain": "/",
|
||||
"LightShowers": ".",
|
||||
"LightSleet": "x",
|
||||
"LightSleetShowers": "x/",
|
||||
"LightSnow": "*",
|
||||
"LightSnowShowers": "*/",
|
||||
"PartlyCloudy": "m",
|
||||
"Sunny": "o",
|
||||
"ThunderyHeavyRain": "/!/",
|
||||
"ThunderyShowers": "!/",
|
||||
"ThunderySnowShowers": "*!*",
|
||||
"VeryCloudy": "mmm",
|
||||
}
|
||||
|
||||
WEATHER_SYMBOL_WIDTH_VTE_WI = {
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ from astral.sun import sun
|
||||
|
||||
import pytz
|
||||
|
||||
from constants import WWO_CODE, WEATHER_SYMBOL, WIND_DIRECTION, WEATHER_SYMBOL_WIDTH_VTE
|
||||
from constants import WWO_CODE, WEATHER_SYMBOL, WIND_DIRECTION, WEATHER_SYMBOL_WIDTH_VTE, WEATHER_SYMBOL_PLAIN
|
||||
from weather_data import get_weather_data
|
||||
from . import v2
|
||||
from . import v3
|
||||
@ -106,6 +106,15 @@ def render_condition_fullname(data, query):
|
||||
|
||||
return weather_condition
|
||||
|
||||
def render_condition_plain(data, query):
|
||||
"""Plain text weather condition (x)
|
||||
"""
|
||||
|
||||
weather_condition = WEATHER_SYMBOL_PLAIN[WWO_CODE[data['weatherCode']]]
|
||||
spaces = " "*(WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition) - 1)
|
||||
|
||||
return weather_condition + spaces
|
||||
|
||||
def render_humidity(data, query):
|
||||
"""
|
||||
humidity (h)
|
||||
@ -249,6 +258,7 @@ def render_local_timezone(data, query, local_time_of):
|
||||
FORMAT_SYMBOL = {
|
||||
'c': render_condition,
|
||||
'C': render_condition_fullname,
|
||||
'x': render_condition_plain,
|
||||
'h': render_humidity,
|
||||
't': render_temperature,
|
||||
'f': render_feel_like_temperature,
|
||||
|
Loading…
Reference in New Issue
Block a user