Repository navigation
✨ Artist art, bios and album extras from the library's own files (plan 072, Phase 1, server) - #121
Merged
Merged
Conversation
…ts and albums get images and bios
…keeps a logo's or a disc's transparency as PNG
…GET /artwork serves every kind's ladder, PNG with alpha
…the artists event
… rows kept for the index standing
…humbs, and a quick scan beside unchanged art
…ir tables, routes and the artists event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan 072, Phase 1, server half: artist art, bios and album extras read from the library's own files. No network, no keys. The UI half waits for the boards; the web client only learns the new types.
What it does
artworkrow no album used, so it would have wiped artist images at the end of the first scan. Once the new tables referenceartwork, it would have failed every scan instead, on the foreign key. It now keeps anything an artist image or album extra uses, and prunes artists before images, so an artist that goes frees its own images.0026_artist_art:artworkrebuilt (create, copy, drop, rename):sourcegainsremote, and a newalphacolumn (copied as 0) says the renditions are PNG.artist_images,album_imagesandartist_bios, all STRICT, cascading with their artist or album. A folder's row records its file (root, path, size, mtime) under a CHECK. Apinnedrow is the administrator's, and no scan touches it.albums.release_group_mbidadded.scrape_stateis left to Phase 2: reading local files needs none.internal/artwork:artist|thumb|folder,fanart*|backdrop*|background,clearlogo|logo,bannerandartist.nfo. Album folder:cdart|discart|discfor every disc,cd2/discart-2for one disc, andback.os.Root. An unchanged file isn't read again except by a full scan. A bad file is logged by its root-relative path, remembered until it changes, and the next name is tried. A pin is never touched. Embedded pictures are not read.ArtistDetail.images(thumb, background, logo and banner, each with colors,alpha,sourceandcredit),bioandmbid.ArtistEntry.thumb.AlbumDetail.extras:discs,backandcoverSource.GET /artwork/{hash}takes every ladder's sizes and answersimage/pngfor alpha images.artistsevent (ids only, to everyone) when a scan changes an artist's images or bio. It has a schema in the contract, a case inevents_test.go, and a place inTestNoEventHoldsASecret, whose nfo holds the secret.Numbers
Measured on this box (Ryzen 9 5950X) while it carried other load (load average 4 to 14). Main's numbers come from a scratch worktree at
f8df1fb, run back to back.GET /library/index, 50k songs (budget 250)GET /library/index?artist=(budget 24)GET /artists/{id}, 50k songsGET /artists, 2,000 artists, 50k songs.m3u8(budget 150)Stream first byte is over its budget on main too, under this load. Nothing on the play path changed.
Rendering and disk:
First scan of the art library (300 distinct images and 50 bios beside 500 songs): 6.8 to 8.5 s, against 80 to 90 ms without art. That is about 25 ms per image, two renders at a time.
Per image, from
BenchmarkPutKindson photo-like sources:Per artist, with all four kinds: about 1.0 MB with a 1080p background, about 2.8 MB with a 4K one. The plan estimated 1 to 2.5 MB.
New budgets in
perf/budgets.json, about 1.5x what was measured:artist-detailartists-listquick-scan-artscrape-artistwaits for Phase 2. The browser suite wasn't run: the client changes are types only, and nothing on the play path moved.Decisions made where the plan left room
artworkonly, not repeated onartist_images.file_root,file_path,file_sizeandfile_mtime.artist_biosgains alicense_urlcolumn, since the API haslicenseUrl.<biography>and<musicBrainzArtistID>directly under<artist>, names matched ignoring case. Each line is a paragraph, and the summary is the first. An nfo naming a different MusicBrainz ID than the artist's is ignored.source = 'pinned'andpinned_byexist, and no scan replaces or removes a pin (tested by writing one directly).GET /artwork/{hash}serves every kind.coverSourceis only everfilesfor now. The Cover Art Archive arrives in Phase 3.ArtistLink, without thumbs. Giving them thumbs means the name index carrying them.