fix(tts): exclude donations and accounting entries
This commit is contained in:
@@ -93,7 +93,15 @@ def get_post_text(pid):
|
||||
check=True, capture_output=True)
|
||||
subprocess.run(["docker", "cp", f"{CONTAINER}:/tmp/fea_es.json", "/tmp/fea_es.json"], check=True)
|
||||
d = json.load(open("/tmp/fea_es.json"))
|
||||
raw = re.sub(r"(?i)</p>|<br\s*/?>|</h[1-6]>", "\n", d["content"])
|
||||
# Hard gate: pages and operational/accounting entries are never TTS input.
|
||||
# This also protects explicit --ids queues, which bypass author-backlog SQL.
|
||||
raw_content = d.get("content", "")
|
||||
blocked_markers = ("fea-don-wrap", "fea-ledger", "Haz tu donación")
|
||||
if d.get("post_type") != "post":
|
||||
raise ValueError(f"post #{pid} no es un artículo (post_type={d.get('post_type')!r}); TTS excluido")
|
||||
if d.get("post_name") == "numeros" or any(marker in raw_content for marker in blocked_markers):
|
||||
raise ValueError(f"post #{pid} es contenido de cuentas/donaciones; TTS excluido")
|
||||
raw = re.sub(r"(?i)</p>|<br\s*/?>|</h[1-6]>", "\n", raw_content)
|
||||
raw = re.sub(r"<[^>]+>", "", raw)
|
||||
raw = re.sub(r"\[[^\]]+\]", "", raw)
|
||||
raw = html.unescape(raw)
|
||||
|
||||
Reference in New Issue
Block a user