Cover art thumbnails
library scan creates thumbnails, cover grid component defaults to thumbnail if available.
This commit is contained in:
@@ -278,9 +278,15 @@ export class CoverGrid extends LitElement {
|
||||
${album.CoverArtPath
|
||||
? html`<img
|
||||
class="cover-image"
|
||||
src="${album.CoverArtPath}"
|
||||
src="${album.CoverArtThumbnailPath || album.CoverArtPath}"
|
||||
alt="${album.Name} cover"
|
||||
loading="lazy"
|
||||
@error=${(e: Event) => {
|
||||
const img = e.target as HTMLImageElement;
|
||||
if (img.src !== album.CoverArtPath) {
|
||||
img.src = album.CoverArtPath;
|
||||
}
|
||||
}}
|
||||
/>`
|
||||
: html`<div class="placeholder-cover">
|
||||
${this.getAlbumInitial(album.Name)}
|
||||
|
||||
@@ -85,7 +85,16 @@ export class NowPlaying extends LitElement {
|
||||
<div class="now-playing">
|
||||
<div class="cover-art">
|
||||
${track.coverArt
|
||||
? html`<img src="${track.coverArt}" alt="Album cover" />`
|
||||
? html`<img
|
||||
src="${track.coverArtThumbnail || track.coverArt}"
|
||||
alt="Album cover"
|
||||
@error=${(e: Event) => {
|
||||
const img = e.target as HTMLImageElement;
|
||||
if (track.coverArt && img.src !== track.coverArt) {
|
||||
img.src = track.coverArt;
|
||||
}
|
||||
}}
|
||||
/>`
|
||||
: html`<div class="cover-placeholder"><wa-icon name="music"></wa-icon></div>`}
|
||||
</div>
|
||||
<div class="track-info">
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface TrackInfo {
|
||||
artist: string; // artist name
|
||||
album: string; // album name
|
||||
coverArt: string; // URL path to cover art (e.g., "/covers/abc.jpg") or empty string
|
||||
coverArtThumbnail: string; // URL path to thumbnail (e.g., "/covers/abc_thumb.jpg") or empty string
|
||||
}
|
||||
|
||||
export interface PlayerState {
|
||||
|
||||
@@ -5,6 +5,7 @@ export namespace library {
|
||||
Name: string;
|
||||
ArtistName: string;
|
||||
CoverArtPath: string;
|
||||
CoverArtThumbnailPath: string;
|
||||
Year: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
@@ -17,6 +18,7 @@ export namespace library {
|
||||
this.Name = source["Name"];
|
||||
this.ArtistName = source["ArtistName"];
|
||||
this.CoverArtPath = source["CoverArtPath"];
|
||||
this.CoverArtThumbnailPath = source["CoverArtThumbnailPath"];
|
||||
this.Year = source["Year"];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user