feat: GET /transcripts/{filename} — serve transcript content
This commit is contained in:
@@ -35,6 +35,17 @@ def save_transcript(
|
||||
return path
|
||||
|
||||
|
||||
def read_transcript(output_dir: str, filename: str) -> str | None:
|
||||
"""Return file content if filename is a plain .md file inside output_dir."""
|
||||
if os.path.basename(filename) != filename or not filename.endswith(".md"):
|
||||
return None
|
||||
path = os.path.join(output_dir, filename)
|
||||
if not os.path.exists(path):
|
||||
return None
|
||||
with open(path, encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def list_transcripts(output_dir: str, limit: int = 20) -> list[dict]:
|
||||
if not os.path.exists(output_dir):
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user