Auto-update: Tue Aug 6 20:20:03 PDT 2024
This commit is contained in:
parent
3dfebb1635
commit
1ffb2fa12a
2 changed files with 7 additions and 7 deletions
|
@ -307,7 +307,7 @@ async def build_daily_note(date_time: dt_datetime, lat: float = None, lon: float
|
|||
Obsidian helper. Takes a datetime and creates a new daily note. Note: it uses the sijapi configuration file to place the daily note and does NOT presently interface with Obsidian's daily note or periodic notes extensions. It is your responsibility to ensure they match.
|
||||
'''
|
||||
absolute_path, _ = assemble_journal_path(date_time)
|
||||
warn(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in build_daily_note.")
|
||||
debug(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in build_daily_note.")
|
||||
formatted_day = date_time.strftime("%A %B %d, %Y") # Monday May 27, 2024 formatting
|
||||
day_before = (date_time - timedelta(days=1)).strftime("%Y-%m-%d %A") # 2024-05-26 Sunday formatting
|
||||
day_after = (date_time + timedelta(days=1)).strftime("%Y-%m-%d %A") # 2024-05-28 Tuesday formatting
|
||||
|
@ -549,7 +549,7 @@ async def note_weather_get(
|
|||
force_refresh_weather = refresh == "True"
|
||||
try:
|
||||
date_time = dt_datetime.now() if date == "0" else await gis.dt(date)
|
||||
warn(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our dt_datetime in note_weather_get.")
|
||||
debug(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our dt_datetime in note_weather_get.")
|
||||
debug(f"date: {date} .. date_time: {date_time}")
|
||||
content = await update_dn_weather(date_time, force_refresh_weather) #, lat, lon)
|
||||
return JSONResponse(content={"forecast": content}, status_code=200)
|
||||
|
@ -565,7 +565,7 @@ async def note_weather_get(
|
|||
@note.post("/update/note/{date}")
|
||||
async def post_update_daily_weather_and_calendar_and_timeslips(date: str, refresh: str="False") -> PlainTextResponse:
|
||||
date_time = await gis.dt(date)
|
||||
warn(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our dt_datetime in post_update_daily_weather_and_calendar_and_timeslips.")
|
||||
debug(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our dt_datetime in post_update_daily_weather_and_calendar_and_timeslips.")
|
||||
force_refresh_weather = refresh == "True"
|
||||
await update_dn_weather(date_time, force_refresh_weather)
|
||||
await update_daily_note_events(date_time)
|
||||
|
@ -574,7 +574,7 @@ async def post_update_daily_weather_and_calendar_and_timeslips(date: str, refres
|
|||
|
||||
|
||||
async def update_dn_weather(date_time: dt_datetime, force_refresh: bool = False, lat: float = None, lon: float = None):
|
||||
warn(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in update_dn_weather.")
|
||||
debug(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in update_dn_weather.")
|
||||
try:
|
||||
if lat and lon:
|
||||
place = await GEO.code((lat, lon))
|
||||
|
|
|
@ -118,7 +118,7 @@ async def get_weather(date_time: dt_datetime, latitude: float, longitude: float,
|
|||
|
||||
|
||||
async def store_weather_to_db(date_time: dt_datetime, weather_data: dict):
|
||||
warn(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in store_weather_to_db")
|
||||
debug(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in store_weather_to_db")
|
||||
try:
|
||||
day_data = weather_data.get('days')[0]
|
||||
debug(f"RAW DAY_DATA: {day_data}")
|
||||
|
@ -127,7 +127,7 @@ async def store_weather_to_db(date_time: dt_datetime, weather_data: dict):
|
|||
stations_array = day_data.get('stations', []) or []
|
||||
|
||||
date_str = date_time.strftime("%Y-%m-%d")
|
||||
warn(f"Using {date_str} in our query in store_weather_to_db.")
|
||||
debug(f"Using {date_str} in our query in store_weather_to_db.")
|
||||
|
||||
# Get location details from weather data if available
|
||||
longitude = weather_data.get('longitude')
|
||||
|
@ -245,7 +245,7 @@ async def store_weather_to_db(date_time: dt_datetime, weather_data: dict):
|
|||
|
||||
|
||||
async def get_weather_from_db(date_time: dt_datetime, latitude: float, longitude: float):
|
||||
warn(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in get_weather_from_db.")
|
||||
debug(f"Using {date_time.strftime('%Y-%m-%d %H:%M:%S')} as our datetime in get_weather_from_db.")
|
||||
query_date = date_time.date()
|
||||
try:
|
||||
# Query to get daily weather data
|
||||
|
|
Loading…
Reference in a new issue