From 4df67bd475122ef7cc67d7f55fd796edd0e26f42 Mon Sep 17 00:00:00 2001
From: Marty Oehme <marty.oehme@gmail.com>
Date: Sat, 18 Jan 2025 14:34:02 +0100
Subject: [PATCH] Default to single line transcript

---
 summarize.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/summarize.py b/summarize.py
index 11e7748..45d5072 100755
--- a/summarize.py
+++ b/summarize.py
@@ -13,7 +13,7 @@ def summarize_text_file(content: str, prompt: str | None) -> str:
     return bot.chat(f"{prompt} {content}")
 
 
-def extract_transcript_contents(content: str) -> str:
+def extract_transcript_contents(content: str, keep_newlines: bool = False) -> str:
     jq_command = "jq '.events.[].segs | select(. != null).[].utf8'"
     result = subprocess.run(
         jq_command, shell=True, capture_output=True, text=True, input=content
@@ -22,7 +22,9 @@ def extract_transcript_contents(content: str) -> str:
     result = result.replace("\n", "").split()
 
     # Join lines back together with newlines
-    processed = " ".join(result).replace('"', "").replace("\\n", "\n")
+    processed = (
+        " ".join(result).replace('"', "").replace("\\n", "\n" if keep_newlines else " ")
+    )
 
     return processed