summaryrefslogtreecommitdiff
path: root/web/js/app.js
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-01 12:49:18 +0300
committerPaul Buetow <paul@buetow.org>2026-05-01 12:49:18 +0300
commit8e08f588bd59a2483be721d5664463535ed1d956 (patch)
tree475b012b50ebf1ac55aaa1746ee2f15781a5d503 /web/js/app.js
parent7e73839aef344012bb11c85d951794039b9933f5 (diff)
Add cover image detection for audio files in scanner
During scanning, when an audio file is found in a directory that also contains an image file (jpg/png/gif), the scanner now assigns that image as the audio file's thumbnail_path. This is common for audiobooks which have cover.jpg alongside the audio files. Changes: - scanner: two-pass walk to collect sibling images, then pair with audio - CSS: add .row-cover style for audio items with covers - JS: render audio rows with cover images when thumbnail_path is set
Diffstat (limited to 'web/js/app.js')
-rw-r--r--web/js/app.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/web/js/app.js b/web/js/app.js
index 884cdcf..e4150ad 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -278,9 +278,12 @@ function renderItem(m, index) {
</div>
`;
}
+ const coverHtml = m.thumbnail_path
+ ? `<img src="/api/media/${m.id}/thumbnail" alt="" loading="lazy" class="row-cover">`
+ : '<span class="row-icon">🎵</span>';
return `
<div class="media-row" data-id="${m.id}" data-index="${index}" tabindex="0" role="button" aria-label="${escapeHtml(m.file_name)}">
- <span class="row-icon">🎵</span>
+ ${coverHtml}
<div class="row-body">
<div class="row-title">${escapeHtml(m.file_name)}</div>
<div class="row-meta">${escapeHtml(m.codec || '')} ${m.bitrate ? Math.round(m.bitrate/1000)+'kbps' : ''} ${sizeText ? '• ' + sizeText : ''}</div>