jukebox
All repositories: gitoria
7.5 KB
# JB2 report: jukebox library screens and playing in the browser**Status: done, committed on main of /media/STORAGE/projects/WorldAPI/jukebox. Not deployed, nothing listens. One new shared component (virtual-list) waits for Atlas's review on a components branch.**## What now exists- **Screens** on the layouts theme (dark, the layouts header with the menu, the phone's sidebar behind the toggle): Songs, Artists, Albums, one artist (switch between albums and songs), one album (large cover on top, songs in track order), Search.- **Songs** sort by artist, title, album or most played. The **Favourites** button keeps the songs played at least N times; N is a field beside it (default 5) and the line under the toolbar shows the count ("8,277 songs" on the test data, 4,572 on the real library for N = 5).- **Search** is one field with results while you type (250 ms after the last key): artists and albums (at most 10 each) above, the songs below. Every word must match.- **Playing:** a tap on a song plays it in the media player, a compact bar at the bottom of the phone (seek line on top, small cover, title and artist, back 10 s, play/pause, forward 10 s; the times from 1280 px). The list the song was tapped in is the queue (the next 40 songs, refilled before they run out; the next song starts when one ends). The bar belongs to the shell, so the music goes on when the screen changes.- **Audio route** `GET /stream/<song id>`: HTTP Range (206, 416 past the end, suffix and open ranges, a list of ranges or garbage is ignored), at most 1 MiB per answer, content type from the format, read with `dd` through hl:proc, the path from the database only. `GET /api/thumb/<cover id>` gives a 96 px cover (ffmpeg, once, cached). `sort=plays` was added to the songs API.- **New shared component `virtual-list`** (components.hybriel branch `jb2-virtual-list`, worktree /media/STORAGE/claude-scratch/atlas/JB2/wtc, three commits on c2834dd, not merged): fixed row height, a spacer as tall as the list, only the rows near the viewport exist (about 35), the host loads rows page by page through a function it hands in (`onRange`), blank rows of the same height until they arrive, a head slot that scrolls away with the rows, `emit vlTop()`. Demo `/virtual-list`, README, own gate `node tests/virtual-list.mjs` (26 checks, 0 failed, at 390 and 1280). The jukebox vendors it, the media player and the icons with `tools/sync-components.sh` (components/SOURCE = 0f330ec, byte-verbatim). The theme is now copied from layouts.worldapi.org (it has the media player's look).## Proof- `node tests/ui.mjs`: **53 checks, 0 failed** — a generated database of 13,450 songs (`tools/make-test-db.hl`, every song points at a 60 s tone), real headless Chrome on loreana, real clicks, real wheel scrolling, real key presses on the sort select. It covers: 13 stream checks (206 with exact bytes, middle, suffix, open range, 416, no Range, unknown id, a path in the URL, POST refused, thumbnail), the songs list (count, rows < 100, 56 px row steps, thumbnail and text on one centre line), scrolling to the end of 13,450 rows with the wheel (rows stay < 100, last row #13,450 with its text, no blank rows), sort by title / album / plays against the API, Favourites count and N = 9, the menu on the phone, search finding "Zebra Fixture Anthem" while typing, the artist and album hit, tap to play (currentTime advances), the compact bar (seek line on top, title inside, three buttons, 50–76 px high, at the bottom), the song going on while the screen changes, the list ending where the bar starts, artist and album screens (cover ≥ 250 px, track order), and at 1280 the header menu, a song without a cover still showing its title in the bar, and the times.- It fails on broken code: with the stream answering 200 instead of 206 six stream checks fail; with the list rendering far too many rows (`overscan = 6000` in the component demo) the component gate stops at its row-count check (the page cannot even be driven). `node tests/gate.mjs` (the JB1 scanner and API gate) still passes: 119/0. `node theme/check-theme.mjs .`: 0 problems.- Screens I looked at (and what I saw): /media/STORAGE/claude-scratch/atlas/JB2/gate-ui/shots/ — `songs-390.png` (dense list, 56 px rows, thumbnails, the count line), `favourites-390.png` (count and the minimum field on one line, button in the accent), `search-390.png` (artists, albums, songs under their headings), `album-390.png` (large cover, name, artist, songs with track numbers, the bar under the list), `player-390.png` (compact bar: seek line on top, cover, title, three buttons), `songs-1280.png`, `search-1280.png`, `album-1280.png`, `player-1280.png`. Fixes made after looking: the favourites line wrapped (the number field took the full width), the bar showed no title for a song without a cover (the player only shows title and artist beside a cover; every song now carries a cover, an empty one when it has none), the seek line sat at the bottom, an album row repeated the artist on every line, the desktop sort select was 1000 px wide, the empty thumbnail vanished on the marked row.- Component gate screenshots: /media/STORAGE/claude-scratch/atlas/JB2/wtc/.scratch/vl-shots/.## The real library (a copy of JB1's database, 13,449 songs, the library only read) at 390 px`node tests/real.mjs` against a copy in /media/STORAGE/claude-scratch/atlas/JB2/real-storage (to be deleted):- first paint of Songs (first rows with their text): **about 100 ms**- scroll with the real wheel to the end of 13,449 songs and the last rows filled: **5.2 s** (80 wheel steps; rows in the page stay < 100, the last row is #13,449)- search for the artist "Gorgous": **0.5–0.7 s from the last key** to the artist, the albums and the songs (that includes the 250 ms wait; the first version asked the server three times and took 2.4 s)- played "I'm Gorgeous": currentTime 5.3 s after 5 s of playing, not paused, streamed from /stream/<id> by dd.Shots: /media/STORAGE/claude-scratch/atlas/JB2/real-shots/. The library was not touched (reads only; the app is the only reader, nothing is written below /media/SLOW1TB1).## Hybriel facts found (no JavaScript written, no gap that stopped the work)- A View `if` and a View attribute take a member or a field path, not an expression (`if (a.img != '')` → a row field `hasImg`).- A derived member (`Hybrid ctx = { sort = sortBy }`) is not yet updated inside the handler that changes `sortBy`: build the value in the handler.- A composed component's slot works (`VirtualList { jbHead { … } }`); client navigation by a link keeps the shell (and the player) alive; `emit` of an event defined in the shell works from a page.- Fields of an object literal shadow the loop variable inside the same literal (`{ i = '' + i pos = i + 1 }` made "01").- mpackdb indexes numbers as text (the playCount index ran 9 before 12): `sort=plays` uses a counting sort instead.## Not done / next- The playing row is marked only after a tap in that list; the next song that starts by itself does not move the mark (the page does not know the shell's playing song).- No playlists, shuffle modes, now-playing overlay, no counting of plays (JB3), no login; the server binds 127.0.0.1 by default.- `/stream` still reads with `dd` (hybriel#233 is the ranged read); file formats Chrome cannot play (wma, ape) are listed but do not play.- Desktop album screen: cover centred above a wide list (fine, but a side-by-side layout would use the width better).- The component branch needs Atlas's review and a merge; then re-run `tools/sync-components.sh` with the merge commit (components/SOURCE names 0f330ec on the branch).
Branches
Latest commits
- 10f8a8c8Merge branch 'code-order' into mainJukebox
- 204fc828Merge branch 'day72' into mainJukebox
- 95f5faae|||PR jukebox#7 Drop needless let declarationsmre
- 33072bb5|||PR Record day72 gates and Chrome proofmre
- 95f2cd73|||PR Use typed parent methods for screen playback and local server facesmre
- 6422a020Sync media-player at 51c3818mre
- b582ba1cVendor complete Hybriel day72 plugin setmre
- 02dccbc9Merge branch 'records-1119' into mainJukebox
- a39e1c23|||PR Records: missions 013-015, reconnect fix livemre
- fc7db075Merge branch 'reconnect-retry' into mainJukebox
- ac6f4c6fL2: plain declaration for a in pickedNextmre
- 2f335086Review round 2: only an explicit queue pick drops pend (not the automatic advance); jb23 records every source changemre
- 3eb6695fReview fixes: action generation, queue pick clears pend, Previous/Next retry the decided request, typed handlersmre
- 7a53c0c2|||PR A tap lost to a dead socket plays after reconnect (mission 015)mre
- 1f0cd77bMerge branch 'records-day41' into mainJukebox
- 67be229f|||PR Records: day41 live (PR #4), mission 012, statusmre
- 0bb027daconductor: caramboleyo is the user, not owner/creatorApollo
- 04f5d9d5Merge branch 'day41' into mainJukebox
- 8ed6da45|||PR README: media-player pin df9e7dfmre
- d5d45fc3|||PR media-player df9e7df (repeat-one fix), sync pin and SOURCEmre