Auto-update: Thu Jul 4 17:43:37 PDT 2024
This commit is contained in:
parent
acb5e0ccaa
commit
0a8073f165
2 changed files with 6 additions and 11 deletions
|
@ -104,8 +104,6 @@ async def handle_exception_middleware(request: Request, call_next):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def load_router(router_name):
|
def load_router(router_name):
|
||||||
router_file = ROUTER_DIR / f'{router_name}.py'
|
router_file = ROUTER_DIR / f'{router_name}.py'
|
||||||
L.DEBUG(f"Attempting to load {router_name.capitalize()}...")
|
L.DEBUG(f"Attempting to load {router_name.capitalize()}...")
|
||||||
|
@ -121,6 +119,7 @@ def load_router(router_name):
|
||||||
else:
|
else:
|
||||||
L.ERR(f"Router file for {router_name} does not exist.")
|
L.ERR(f"Router file for {router_name} does not exist.")
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
if args.test:
|
if args.test:
|
||||||
load_router(args.test)
|
load_router(args.test)
|
||||||
|
@ -131,10 +130,10 @@ def main(argv):
|
||||||
if getattr(API.MODULES, module_name):
|
if getattr(API.MODULES, module_name):
|
||||||
load_router(module_name)
|
load_router(module_name)
|
||||||
|
|
||||||
|
|
||||||
config = HypercornConfig()
|
config = HypercornConfig()
|
||||||
config.bind = [API.BIND] # Use the resolved BIND value
|
config.bind = [API.BIND] # Use the resolved BIND value
|
||||||
asyncio.run(serve(api, config))
|
asyncio.run(serve(api, config))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv[1:])
|
main(sys.argv[1:])
|
|
@ -404,7 +404,7 @@ async def update_dn_weather(date_time: dt_datetime, force_refresh: bool = False,
|
||||||
place = places[0]
|
place = places[0]
|
||||||
lat = place.latitude
|
lat = place.latitude
|
||||||
lon = place.longitude
|
lon = place.longitude
|
||||||
|
tz = await GEO.tz_at(lat, lon)
|
||||||
L.DEBUG(f"lat: {lat}, lon: {lon}, place: {place}")
|
L.DEBUG(f"lat: {lat}, lon: {lon}, place: {place}")
|
||||||
city = GEO.find_override_location(lat, lon)
|
city = GEO.find_override_location(lat, lon)
|
||||||
if city:
|
if city:
|
||||||
|
@ -460,8 +460,8 @@ async def update_dn_weather(date_time: dt_datetime, force_refresh: bool = False,
|
||||||
uvindex = DailyWeather.get('uvindex', 0)
|
uvindex = DailyWeather.get('uvindex', 0)
|
||||||
uvwarn = f" - :LiRadiation: Caution! UVI today is {uvindex}! :LiRadiation:\n" if (uvindex and uvindex > 8) else ""
|
uvwarn = f" - :LiRadiation: Caution! UVI today is {uvindex}! :LiRadiation:\n" if (uvindex and uvindex > 8) else ""
|
||||||
|
|
||||||
sunrise = DailyWeather.get('sunrise')
|
sunrise = await loc.dt(DailyWeather.get('sunrise'), tz)
|
||||||
sunset = DailyWeather.get('sunset')
|
sunset = await loc.dt(DailyWeather.get('sunset'), tz)
|
||||||
srise_str = sunrise.time().strftime("%H:%M")
|
srise_str = sunrise.time().strftime("%H:%M")
|
||||||
sset_str = sunset.time().strftime("%H:%M")
|
sset_str = sunset.time().strftime("%H:%M")
|
||||||
|
|
||||||
|
@ -494,16 +494,12 @@ async def update_dn_weather(date_time: dt_datetime, force_refresh: bool = False,
|
||||||
times, condition_symbols, temps, winds = [], [], [], []
|
times, condition_symbols, temps, winds = [], [], [], []
|
||||||
|
|
||||||
for hour in HourlyWeather:
|
for hour in HourlyWeather:
|
||||||
|
hour['datetime'] = await loc.dt(hour.get('datetime'), tz)
|
||||||
if hour.get('datetime').strftime("%H:%M:%S") in HOURLY_COLUMNS_MAPPING.values():
|
if hour.get('datetime').strftime("%H:%M:%S") in HOURLY_COLUMNS_MAPPING.values():
|
||||||
|
|
||||||
times.append(format_hourly_time(hour))
|
times.append(format_hourly_time(hour))
|
||||||
|
|
||||||
condition_symbols.append(format_hourly_icon(hour, sunrise, sunset))
|
condition_symbols.append(format_hourly_icon(hour, sunrise, sunset))
|
||||||
|
|
||||||
temps.append(format_hourly_temperature(hour))
|
temps.append(format_hourly_temperature(hour))
|
||||||
|
|
||||||
winds.append(format_hourly_wind(hour))
|
winds.append(format_hourly_wind(hour))
|
||||||
|
|
||||||
detailed_forecast += assemble_hourly_data_table(times, condition_symbols, temps, winds)
|
detailed_forecast += assemble_hourly_data_table(times, condition_symbols, temps, winds)
|
||||||
detailed_forecast += f"```\n\n"
|
detailed_forecast += f"```\n\n"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue