|
|
@ -118,6 +118,21 @@ def get_json():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fetch_lines(db_conn, start_time, end_time, ts_query=None, limit=None, offset=None):
|
|
|
|
def fetch_lines(db_conn, start_time, end_time, ts_query=None, limit=None, offset=None):
|
|
|
|
|
|
|
|
if ts_query is None:
|
|
|
|
|
|
|
|
query = "SELECT *" + \
|
|
|
|
|
|
|
|
",transcription_line AS highlighted_text" + \
|
|
|
|
|
|
|
|
" FROM buscribe_all_transcriptions WHERE start_time >= %(start_time)s AND end_time <= %(end_time)s " + \
|
|
|
|
|
|
|
|
"ORDER BY start_time "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if limit is not None:
|
|
|
|
|
|
|
|
query += "LIMIT %(limit)s "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if offset is not None:
|
|
|
|
|
|
|
|
query += "OFFSET %(limit)s "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query += ";"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
query = f"""
|
|
|
|
query = f"""
|
|
|
|
WITH q AS (
|
|
|
|
WITH q AS (
|
|
|
|
SELECT convert_query({"%(text_query)s" if ts_query is not None else "NULL"})
|
|
|
|
SELECT convert_query({"%(text_query)s" if ts_query is not None else "NULL"})
|
|
|
|