Add album art page for uploading, retrying and correcting missing art
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QHPkt2v797pphGCFKfTFmv
This commit is contained in:
1 parent
bee83cb9f3
commit
9c84a64d4e
6 files changed
+226
-4
No files matched your search
+9
-1
@@ -6,12 +6,20 @@ import { h } from "./dom.js";
|
||||
|
||||
const cache = new Map(); // dedupes repeat/concurrent lookups for the same album within a page
|
||||
|
||||
const keyFor = (artist, album) => `${artist.toLowerCase()}␟${album.toLowerCase()}`;
|
||||
|
||||
// Forget a looked-up album (after the user uploads or corrects its art) so the next
|
||||
// artThumb() for it asks the server again instead of reusing the stale answer.
|
||||
export function forgetArt(artist, album) {
|
||||
cache.delete(keyFor(artist, album));
|
||||
}
|
||||
|
||||
export function artThumb(artist, album, extraClass) {
|
||||
const classes = extraClass ? `art-thumb ${extraClass}` : "art-thumb";
|
||||
const el = h("div", { class: `${classes} art-thumb-empty` });
|
||||
if (!album) return el; // nothing to look up
|
||||
|
||||
const key = `${artist.toLowerCase()}␟${album.toLowerCase()}`;
|
||||
const key = keyFor(artist, album);
|
||||
if (!cache.has(key)) {
|
||||
cache.set(
|
||||
key,
|
||||
|
||||
Reference in new issue
Block a user