feat: album art fallback for artist grid view
Artists without dedicated images (from fanart.tv, TheAudioDB, Wikidata, etc) now fall back to their most popular album's cover art in the library artist grid. Uses the appropriate size tier based on device pixel ratio — CoverArtSmall for small avatars, CoverArtMedium/Large for larger ones. Only letter-initial placeholder remains as the absolute last resort.
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
} from '@go/library/Library';
|
||||
import { library } from '@go/models';
|
||||
import { LibraryController } from '@store/controllers/library-controller';
|
||||
import { libraryStore } from '@store/library-store';
|
||||
import { SearchController } from '@store/controllers/search-controller';
|
||||
import { queueStore } from '@store/queue-store';
|
||||
import {
|
||||
@@ -995,6 +996,26 @@ export class ArtistsView
|
||||
imageURL = artist.ImageLarge || '';
|
||||
}
|
||||
|
||||
// Fallback: use album cover art if no artist image.
|
||||
if (!imageURL) {
|
||||
const cachedAlbums = libraryStore.cachedAlbums;
|
||||
if (cachedAlbums) {
|
||||
const name = artist.Name.toLowerCase();
|
||||
|
||||
for (const a of cachedAlbums) {
|
||||
if (a.ArtistName.toLowerCase() === name) {
|
||||
if (needed <= 100) {
|
||||
imageURL = a.CoverArtSmall || a.CoverArtMedium || '';
|
||||
} else {
|
||||
imageURL = a.CoverArtMedium || a.CoverArtLarge || '';
|
||||
}
|
||||
|
||||
if (imageURL) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imageURL) {
|
||||
return html`<img
|
||||
class="avatar-image"
|
||||
|
||||
Reference in New Issue
Block a user