More fixes

This commit is contained in:
2025-09-07 12:40:08 +02:00
parent b2ce0459af
commit 8c84e27a0a

View File

@@ -116,13 +116,17 @@ def search():
ctx = h.get("_formatted",{}).get("text", h.get("text","")[:300])
segs = h.get("segments",[])
ts = int(segs[0]["start"]) if segs else 0
open_link = f"/open?file={{requests.utils.quote(src)}}&t={ts}" if typ=='podcast' else f"/open?file={{requests.utils.quote(src)}}"
if typ == 'podcast':
open_link = f"/open?file={requests.utils.quote(src)}&t={ts}"
else:
open_link = f"/open?file={requests.utils.quote(src)}"
transcript_link = f" | <a href=\"/subtitle?file={requests.utils.quote(src)}\">Transcript</a>" if typ == 'podcast' else ""
badge = f"<span class='badge'>{typ}</span>"
out.append(
f"<div class='card'><b>{badge}{t}</b><br><small>{src}</small>"
f"<p>{ctx}</p>"
f"<a href='{open_link}'>Open</a>"
f"{' | <a href=\"/subtitle?file='+requests.utils.quote(src)+'\">Transcript</a>' if typ=='podcast' else ''}"
f"{transcript_link}"
f"</div>"
)
return "\n".join(out) or "<small>No results yet.</small>"