gpt
This commit is contained in:
parent
7794fa26e0
commit
0c32da87a9
|
|
@ -770,12 +770,18 @@ def insert_usefulinfo_record(parsed):
|
||||||
tag_id = _get_or_create_tag_id(CUR, str(t))
|
tag_id = _get_or_create_tag_id(CUR, str(t))
|
||||||
if tag_id:
|
if tag_id:
|
||||||
try:
|
try:
|
||||||
|
CUR.execute("SAVEPOINT sp_tag")
|
||||||
CUR.execute(
|
CUR.execute(
|
||||||
"INSERT INTO useful_info_summary_tag (summary_id, tag_id) VALUES (%s, %s) ON CONFLICT DO NOTHING",
|
"INSERT INTO useful_info_summary_tag (summary_id, tag_id) VALUES (%s, %s) ON CONFLICT DO NOTHING",
|
||||||
(summary_id, tag_id)
|
(summary_id, tag_id)
|
||||||
)
|
)
|
||||||
|
CUR.execute("RELEASE SAVEPOINT sp_tag")
|
||||||
|
except Exception as ex_tag_link:
|
||||||
|
try:
|
||||||
|
CUR.execute("ROLLBACK TO SAVEPOINT sp_tag")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
print("[usefulinfo][tag-link-failed] summary_id=", summary_id, " tag=", t, " error=", str(ex_tag_link))
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
if summary_id and isinstance(events, list):
|
if summary_id and isinstance(events, list):
|
||||||
|
|
@ -823,6 +829,7 @@ def insert_usefulinfo_record(parsed):
|
||||||
computed_minutes = _mins(raw_len)
|
computed_minutes = _mins(raw_len)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
CUR.execute("SAVEPOINT sp_event")
|
||||||
CUR.execute(
|
CUR.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO useful_info_event (dt, length, title, description)
|
INSERT INTO useful_info_event (dt, length, title, description)
|
||||||
|
|
@ -833,14 +840,28 @@ def insert_usefulinfo_record(parsed):
|
||||||
)
|
)
|
||||||
evrow = CUR.fetchone()
|
evrow = CUR.fetchone()
|
||||||
if evrow and evrow[0]:
|
if evrow and evrow[0]:
|
||||||
|
try:
|
||||||
|
CUR.execute("SAVEPOINT sp_evlink")
|
||||||
CUR.execute(
|
CUR.execute(
|
||||||
"INSERT INTO useful_info_summary_event (summary_id, event_id) VALUES (%s, %s) ON CONFLICT DO NOTHING",
|
"INSERT INTO useful_info_summary_event (summary_id, event_id) VALUES (%s, %s) ON CONFLICT DO NOTHING",
|
||||||
(summary_id, evrow[0])
|
(summary_id, evrow[0])
|
||||||
)
|
)
|
||||||
|
CUR.execute("RELEASE SAVEPOINT sp_evlink")
|
||||||
|
except Exception as ex_evlink:
|
||||||
|
try:
|
||||||
|
CUR.execute("ROLLBACK TO SAVEPOINT sp_evlink")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
print("[usefulinfo][event-link-failed] summary_id=", summary_id, " event_id=", evrow[0], " error=", str(ex_evlink))
|
||||||
print(f"[usefulinfo] inserted event id={evrow[0]} (summary_id={summary_id}) dt='{dt_str}' parsed={parsed_ok} iso='{parsed_iso}' all_day={all_day} minutes={computed_minutes} title='{raw_title}'")
|
print(f"[usefulinfo] inserted event id={evrow[0]} (summary_id={summary_id}) dt='{dt_str}' parsed={parsed_ok} iso='{parsed_iso}' all_day={all_day} minutes={computed_minutes} title='{raw_title}'")
|
||||||
else:
|
else:
|
||||||
print(f"[usefulinfo][warn] no event id returned for dt='{dt_str}' title='{raw_title}'")
|
print(f"[usefulinfo][warn] no event id returned for dt='{dt_str}' title='{raw_title}'")
|
||||||
|
CUR.execute("RELEASE SAVEPOINT sp_event")
|
||||||
except Exception as ex_ins:
|
except Exception as ex_ins:
|
||||||
|
try:
|
||||||
|
CUR.execute("ROLLBACK TO SAVEPOINT sp_event")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
print("[usefulinfo][event-insert-failed] summary_id=", summary_id,
|
print("[usefulinfo][event-insert-failed] summary_id=", summary_id,
|
||||||
" event=", e,
|
" event=", e,
|
||||||
" dt_str=", dt_str,
|
" dt_str=", dt_str,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue