feat: add optional HLTB enrichment
CI / test (push) Successful in 7m10s

This commit is contained in:
strsv committed 2026-11-06 22:16:27 +03:00
1 parent b865a4a389
commit d07dec5e75
19 files changed
+258 -23

No files matched your search

+7 -2
View File
@@ -476,6 +476,11 @@ def serialize(r, tags, genres, details):
"metacritic": r["metacritic"],
"hours": round((r["minutes"] or 0) / 60, 1),
"duration": r["estimated_hours"],
"hltb": {
"main": r["hltb_main"] if "hltb_main" in r.keys() else None,
"extra": r["hltb_extra"] if "hltb_extra" in r.keys() else None,
"complete": r["hltb_complete"] if "hltb_complete" in r.keys() else None,
} if "hltb_main" in r.keys() and r["hltb_main"] else None,
"installed": bool(r["installed"]),
"status": r["status"],
"rating": r["rating"],
@@ -1006,7 +1011,7 @@ class Handler(BaseHTTPRequestHandler):
total = con.execute(f"SELECT COUNT(*) c {base}", params).fetchone()["c"]
rows = con.execute(
f""" SELECT g.appid, g.name, g.release_date, g.metacritic, g.review_pct,
g.estimated_hours,
g.estimated_hours, g.hltb_main, g.hltb_extra, g.hltb_complete,
COALESCE(p.minutes,0) minutes, COALESCE(i.installed,0) installed,
COALESCE(pe.status,'backlog') status, pe.rating,
COALESCE(pe.favorite,0) favorite, pe.notes
@@ -1104,7 +1109,7 @@ class Handler(BaseHTTPRequestHandler):
try:
r = con.execute("""
SELECT g.appid, g.name, g.type, g.release_date, g.metacritic, g.review_pct,
g.estimated_hours,
g.estimated_hours, g.hltb_main, g.hltb_extra, g.hltb_complete,
COALESCE(p.minutes,0) minutes, p.last_played,
COALESCE(i.installed,0) installed, i.size_bytes,
COALESCE(pe.status,'backlog') status, pe.rating,
+2 -1
View File
@@ -1184,7 +1184,8 @@ function renderModal(g) {
const meta = [
g.year ? `<span><b>${esc(g.year)}</b></span>` : "",
g.review != null ? `<span><b>${g.review}%</b> отзывов</span>` : "",
g.duration ? `<span title="оценка по тегам"><b>${fmtDuration(g.duration)}</b></span>` : "",
g.duration ? `<span title="${g.hltb ? "HowLongToBeat" : "оценка по тегам"}"><b>${fmtDuration(g.duration)}</b></span>` : "",
g.hltb?.complete ? `<span class="muted" title="HLTB: main / main+extra / 100%">HLTB ${Math.round(g.hltb.main || g.duration)} / ${Math.round(g.hltb.complete)} ч</span>` : "",
g.metacritic != null ? `<span>MC <b>${g.metacritic}</b></span>` : "",
g.hours ? `<span><b>${fmtHours(g.hours)}</b></span>` : "",
g.installed ? `<span class="muted">установлена${g.size_gb ? " · " + g.size_gb + " ГБ" : ""}</span>` : "",