From 2309393e3cb7f8ef5000dafce177d9d584001664 Mon Sep 17 00:00:00 2001 From: Fisto Date: Wed, 16 Sep 2026 13:52:17 +0200 Subject: [PATCH] Poll scrape progress and show page totals --- CURRENT.md | 4 ++++ docs/media.md | 5 ++++- poc/public/media.js | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CURRENT.md b/CURRENT.md index ccb72ce..fa499bc 100644 --- a/CURRENT.md +++ b/CURRENT.md @@ -40,6 +40,10 @@ mobile draft at 390px. - [x] C11 preview caching: Discord-hosted image/GIF previews (WebP 320px, hash-addressed, 5 MiB cap, one attempt) run after every walk in both modes. Live run `...-20260916090722`: `previewed: 2`; thumbs served over `/api/media///thumb` (200). + - [x] C25 Live scrape progress. The media tab polls `/api/media/scrapes` every 4 s while open, + so the running row counts update; pages show `X/Yp (~Z%)` from `estimatedMessages` when the + search total is available (some channels deny the bot search with Missing Access, so it stays + optional). Live: pages/messages incremented 2→10 during a walk on `gernal_chut`. - [x] C24 Embeddable items open straight into their player: clicking a YouTube/Vimeo/Twitch/ Streamable card shows the iframe immediately, no extra play press. Non-embeddable videos keep the still + play icon. diff --git a/docs/media.md b/docs/media.md index 9758f34..19bd10d 100644 --- a/docs/media.md +++ b/docs/media.md @@ -164,7 +164,10 @@ that deletion is irreversible. The delete button is disabled for a 5 second coun downloads, an ffprobe probe. GIF tiles carry a translucent **GIF** label top-left; the cached preview is a static frame and the animated GIF plays while hovering. The status row reads `(Images/Videos) | Downloaded I/V | Cached I/V | Loaded I/V` — image counts include GIFs, and - each slot is the count for the active filters. A scrape strip shows live progress with Stop. + each slot is the count for the active filters. A scrape strip shows live progress with Stop; it + polls every 4 seconds while the tab is open and shows `X/Yp (~Z%)` when the search total is + known. Some channels deny the bot the search endpoint (`Missing Access`) even though history + reads work, so the total is optional. **New scrape…** (rightmost) opens a popup with Server and Group chat trees (servers expand to channels; each row has Links and Download). Every scrape button asks for confirmation; the dialog takes optional From/To dates and a **Check Message Count** button (Discord search total, diff --git a/poc/public/media.js b/poc/public/media.js index c3b1fdc..c863bf3 100644 --- a/poc/public/media.js +++ b/poc/public/media.js @@ -176,7 +176,6 @@ setStatus(`media status failed: ${error.message}`); } renderScrapes(); - if (state.view === "media") renderToolbar(); } function filterQuery() { @@ -292,11 +291,20 @@ row.append(el("span", "vk-media-pulse")); } + // Discord search gives the total, so the page count is known up front. + const estimatedPages = + scrape.estimatedMessages != null ? Math.max(1, Math.ceil(scrape.estimatedMessages / 100)) : null; + const pageText = estimatedPages ? `${scrape.pages}/${estimatedPages}p` : `${scrape.pages}p`; + const percent = + estimatedPages && scrape.state !== "queued" + ? ` (~${Math.min(100, Math.round((scrape.pages / estimatedPages) * 100))}%)` + : ""; + row.append( el( "span", null, - `${channelLabel(scrape.channelId)} · ${scrape.state} · ${scrape.pages}p · ${scrape.messages}m · ` + + `${channelLabel(scrape.channelId)} · ${scrape.state} · ${pageText}${percent} · ${scrape.messages}m · ` + `img ${media.image ?? 0} gif ${media.gif ?? 0} vid ${media.video ?? 0} aud ${media.audio ?? 0}` + (scrape.downloaded ? ` · files ${scrape.downloaded}` : "") + (scrape.previewed ? ` · previews ${scrape.previewed}` : "") @@ -754,6 +762,11 @@ if (state.view !== "bot") void refreshErrors(); }, 15000); + // Keep the running-scrape strip live while the media view is open. + setInterval(() => { + if (state.view === "media") void loadScrapes(); + }, 4000); + // ---- Scrape popup: server or group-chat trees ---- const scrapeModal = document.createElement("div");