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
|
||||
|
||||
|
||||
|
||||
|
||||
def load_router(router_name):
|
||||
router_file = ROUTER_DIR / f'{router_name}.py'
|
||||
L.DEBUG(f"Attempting to load {router_name.capitalize()}...")
|
||||
|
@ -121,6 +119,7 @@ def load_router(router_name):
|
|||
else:
|
||||
L.ERR(f"Router file for {router_name} does not exist.")
|
||||
|
||||
|
||||
def main(argv):
|
||||
if args.test:
|
||||
load_router(args.test)
|
||||
|
@ -131,10 +130,10 @@ def main(argv):
|
|||
if getattr(API.MODULES, module_name):
|
||||
load_router(module_name)
|
||||
|
||||
|
||||
config = HypercornConfig()
|
||||
config.bind = [API.BIND] # Use the resolved BIND value
|
||||
asyncio.run(serve(api, config))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
|
@ -404,7 +404,7 @@ async def update_dn_weather(date_time: dt_datetime, force_refresh: bool = False,
|
|||
place = places[0]
|
||||
lat = place.latitude
|
||||
lon = place.longitude
|
||||
|
||||
tz = await GEO.tz_at(lat, lon)
|
||||
L.DEBUG(f"lat: {lat}, lon: {lon}, place: {place}")
|
||||
city = GEO.find_override_location(lat, lon)
|
||||
if city:
|
||||
|
@ -460,8 +460,8 @@ async def update_dn_weather(date_time: dt_datetime, force_refresh: bool = False,
|
|||
uvindex = DailyWeather.get('uvindex', 0)
|
||||
uvwarn = f" - :LiRadiation: Caution! UVI today is {uvindex}! :LiRadiation:\n" if (uvindex and uvindex > 8) else ""
|
||||
|
||||
sunrise = DailyWeather.get('sunrise')
|
||||
sunset = DailyWeather.get('sunset')
|
||||
sunrise = await loc.dt(DailyWeather.get('sunrise'), tz)
|
||||
sunset = await loc.dt(DailyWeather.get('sunset'), tz)
|
||||
srise_str = sunrise.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 = [], [], [], []
|
||||
|
||||
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():
|
||||
|
||||
times.append(format_hourly_time(hour))
|
||||
|
||||
condition_symbols.append(format_hourly_icon(hour, sunrise, sunset))
|
||||
|
||||
temps.append(format_hourly_temperature(hour))
|
||||
|
||||
winds.append(format_hourly_wind(hour))
|
||||
|
||||
detailed_forecast += assemble_hourly_data_table(times, condition_symbols, temps, winds)
|
||||
detailed_forecast += f"```\n\n"
|
||||
|
||||
|
|
Loading…
Reference in a new issue