Sources table: Media column (image coverage % + paywall marker)
Per Codex — make the table more decision-ready from data we already have. Paywall is a domain-level hint, so it's a per-source flag (not a meaningful rate): show image-coverage % plus a 🔒 marker for subscription domains in one compact "Media" column (tooltip spells it out). source_health gains a `paywalled` flag (is_paywalled on homepage/feed); also added to sources.csv. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -1046,7 +1046,7 @@ def create_app() -> FastAPI:
|
||||
row([
|
||||
"name", "feed_url", "homepage", "status", "visible", "served", "accepted_total",
|
||||
"total_articles", "acceptance_pct", "duplicate_pct", "accepted_dup_pct",
|
||||
"image_coverage_pct", "last_success", "last_error", "retry_after", "review_flag", "review_reason",
|
||||
"image_coverage_pct", "paywalled", "last_success", "last_error", "retry_after", "review_flag", "review_reason",
|
||||
])
|
||||
for s in rows:
|
||||
row([
|
||||
@@ -1054,6 +1054,7 @@ def create_app() -> FastAPI:
|
||||
s.get("status") or "", "yes" if s.get("content_visible") else "no",
|
||||
s["served"], s["accepted_total"], s["total_articles"],
|
||||
s["acceptance_rate"], s["duplicate_rate"], s["accepted_dup_rate"], s["image_coverage"],
|
||||
"yes" if s.get("paywalled") else "no",
|
||||
s.get("last_success_at") or "", s.get("last_error") or "", s.get("retry_after_at") or "",
|
||||
"yes" if s.get("review_flag") else "no", s.get("review_reason") or "",
|
||||
])
|
||||
|
||||
@@ -11,6 +11,7 @@ import sqlite3
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
from .feeds import MAX_BACKOFF_MINUTES
|
||||
from .paywall import is_paywalled
|
||||
|
||||
# Composite ranking used everywhere a "best first" order is needed. Kept as one
|
||||
# expression so brief, category feeds, and the API all rank identically.
|
||||
@@ -332,6 +333,8 @@ def source_health(conn: sqlite3.Connection) -> list[dict]:
|
||||
# duplicate of content already served (accepted_total − served = accepted dupes).
|
||||
d["accepted_dup_rate"] = round(100 * (accepted - d["served"]) / accepted) if accepted else None
|
||||
d["image_coverage"] = round(100 * (d["images"] or 0) / d["served"]) if d["served"] else None
|
||||
# Paywall is a domain-level hint, so it's a per-source flag (not a rate).
|
||||
d["paywalled"] = is_paywalled(d.get("homepage_url") or d.get("feed_url"))
|
||||
# Match the REAL scheduler gate: due = the later of the streak-backoff time
|
||||
# and any retry_after_at rest (UTC strings sort chronologically).
|
||||
due_times = [t for t in (d["next_due_at"], d["retry_after_at"]) if t]
|
||||
|
||||
Reference in New Issue
Block a user