diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-08-26 01:09:04 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-08-26 01:09:04 +0200 |
| commit | 52707f6280bb268102cd60e692c0199a45caf35e (patch) | |
| tree | 1220d39cb30ccc8a58a80f85ba020b5b30bea9b7 /packages/meshbay-hub/src/meshbay_hub/static/music-app.js | |
| parent | 704cfe37506fc5316c997b025004fbc9c4d2a47b (diff) | |
| parent | 2d144d76cee55cf8faaacf196e716a0930dfd7e9 (diff) | |
| download | meshbay-52707f6280bb268102cd60e692c0199a45caf35e.tar.gz | |
Merge branch 'fix/meta-lookup-by-file-id'
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013XSohfUQQiaE77qyFLgSv3
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/music-app.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/music-app.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/music-app.js b/packages/meshbay-hub/src/meshbay_hub/static/music-app.js index 298e259..ae482ad 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/music-app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/music-app.js @@ -131,21 +131,21 @@ function groupMusicEntries(entries, audioRoot) { // -- album cover, MusicBrainz fetched lazily and only when actually needed -- -function useMusicMeta(transportRef, path, active) { +function useMusicMeta(transportRef, fileId, active) { const [meta, setMeta] = useState(null); useEffect(() => { - if (!active || !path) return; + if (!active || !fileId) return; let cancelled = false; (async () => { const transport = transportRef.current; if (!transport || !transport.connected) return; try { - const resp = await transport.fetchMusicMeta(path); + const resp = await transport.fetchMusicMeta(fileId); if (!cancelled) setMeta(resp); } catch { if (!cancelled) setMeta({ confidence: 0 }); } })(); return () => { cancelled = true; }; - }, [path, active]); + }, [fileId, active]); return meta; } @@ -196,7 +196,7 @@ function AlbumCard({ album, transportRef, gekRef, musicbrainzEnabled, onOpen }) // Only when nothing in the library already gives us a cover -- the common // case (a well-tagged rip with embedded art) needs no network call at all. const needsLookup = musicbrainzEnabled && !repTrack.thumb_hash; - const meta = useMusicMeta(transportRef, repTrack.path, needsLookup); + const meta = useMusicMeta(transportRef, repTrack.id, needsLookup); const coverHash = repTrack.thumb_hash || (meta && meta.cover_thumb_hash) || null; return html` @@ -218,7 +218,7 @@ function AlbumCard({ album, transportRef, gekRef, musicbrainzEnabled, onOpen }) function MusicDetailModal({ album, transportRef, gekRef, musicbrainzEnabled, onClose, onPlayQueue }) { const repTrack = album.tracks.find((tr) => tr.thumb_hash) || album.tracks[0]; const needsLookup = musicbrainzEnabled && !repTrack.thumb_hash; - const meta = useMusicMeta(transportRef, repTrack.path, needsLookup); + const meta = useMusicMeta(transportRef, repTrack.id, needsLookup); const coverHash = repTrack.thumb_hash || (meta && meta.cover_thumb_hash) || null; return html` |