From 59a9f4984c3acd29bc746a78e30849f50fa555ee Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sat, 15 Aug 2026 18:57:59 +0900 Subject: Add Claude-powered band auto-registration from live info text Extracts band/artist names from pasted live info via Claude (API or CLI adapter), matches against existing bands, and lets the user review and bulk-register new ones through a polling job queue. Also adds a livehouse events import script and recent-bands/artists home page sections. Co-Authored-By: Claude Sonnet 5 --- app/lib/worker.server.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/lib/worker.server.ts (limited to 'app/lib/worker.server.ts') diff --git a/app/lib/worker.server.ts b/app/lib/worker.server.ts new file mode 100644 index 0000000..f71ea40 --- /dev/null +++ b/app/lib/worker.server.ts @@ -0,0 +1,32 @@ +import { claimNextParseJob, completeParseJob, failParseJob, listBands } from "./db.server"; +import { parseLiveInfoBands } from "./claude.server"; + +const POLL_INTERVAL_MS = 2000; + +let started = false; + +function startWorker() { + if (started) return; + started = true; + + let busy = false; + + setInterval(async () => { + if (busy) return; + const job = claimNextParseJob(); + if (!job) return; + + busy = true; + try { + const bands = listBands(); + const matches = await parseLiveInfoBands(job.input_text, bands); + completeParseJob(job.id, JSON.stringify(matches)); + } catch (e) { + failParseJob(job.id, e instanceof Error ? e.message : "不明なエラー"); + } finally { + busy = false; + } + }, POLL_INTERVAL_MS); +} + +startWorker(); -- cgit v1.2.3