From 9157e2ecf719caf086a6caabaefad8eaeb4334a1 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 20 Jul 2026 23:46:47 -0400 Subject: [PATCH] Remove hover-preview; delegate to song_preview plugin Folder Library now uses the standard data-fn/data-v3-play markup so the song_preview plugin handles hover-previews, the same way it does for grid and list views. Removes ~200 lines of preview-specific code: dedicated audio element, indicator rendering, toolbar toggle, and backend manifest checking. The preview experience is now unified across all library surfaces. Signed-off-by: Kyle --- plugins/folder_library/CLAUDE.md | 18 +-- plugins/folder_library/README.md | 4 +- plugins/folder_library/routes.py | 16 +- plugins/folder_library/screen.js | 150 ++---------------- .../folder_library/tests/preview_url.test.js | 71 --------- .../tests/song_preview_markup.test.js | 116 ++++++++++++++ 6 files changed, 141 insertions(+), 234 deletions(-) delete mode 100644 plugins/folder_library/tests/preview_url.test.js create mode 100644 plugins/folder_library/tests/song_preview_markup.test.js diff --git a/plugins/folder_library/CLAUDE.md b/plugins/folder_library/CLAUDE.md index f687dbb..dc69ab5 100644 --- a/plugins/folder_library/CLAUDE.md +++ b/plugins/folder_library/CLAUDE.md @@ -153,15 +153,14 @@ Each song object (built by `_meta()`): "added": 1748132400.0, "arrangements": ["Lead", "Rhythm", "Bass"], "stems": ["Drums", "Bass", "Vocals"], - "lyrics": true, - "has_preview": true + "lyrics": true } ``` - `filename` is the full relative path from the DLC root — pass it directly to `window.playSong()`. - `added` is a Unix timestamp (float, seconds) from `stat().st_mtime` — convert with `new Date(added * 1000)`. Always recomputed fresh (it changes when a file moves), even on a metadata-cache hit. - `arrangements` / `stems` are flat lists of **strings**, even though `extract_meta()` returns them as objects. -- `has_preview` is set from the pack's manifest `preview:` key (via core `load_manifest`) — `true` iff `song_preview` will actually serve a preview. The frontend previews **only** `has_preview` songs, so hover never requests (and 404-logs) a preview-less pack. Hover-preview audio itself is **not** resolved here — it comes from the `song_preview` endpoint (see Preview on Hover). +- Hover-preview isn't resolved here at all — the cards just carry `data-fn`/`data-v3-play` markup and the `song_preview` plugin handles it (see Preview on Hover). ### extract_meta returns arrangements/stems as objects, not strings @@ -333,17 +332,16 @@ Drag-and-drop uses **pointer events** (mousedown/mousemove/mouseup), not the HTM ## Preview on Hover -Hovering a song for `_HOVER_PREVIEW_DELAY_MS` (800 ms) plays a short audio preview in place — no navigation to the player. Toggled by a play-icon toolbar button (`_injectToolbar`); **on by default** (`_previewHover`, persisted per surface under `previewHover` — only an explicit stored `'false'` disables it). +The Folder Library does **not** implement hover-preview itself — the `song_preview` plugin does, for the whole app. Its hover loop finds song elements by the selector `#v3-songs [data-fn]` (with a `[data-v3-play]` playable surface) and its `MutationObserver` watches the `#v3-songs` subtree — and the folder view (`#lib-folder-tree`) renders **inside** `#v3-songs`. So all folder_library has to do is give each card/row the standard markup: -- **Audio** — a dedicated `_previewAudio` `