Skip to content

Commit 395d1a7

Browse files
committed
Add support for missing artwork fallback in the panel area as well as the included snippet.
1 parent 68d0e11 commit 395d1a7

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

assets/missing-artwork.jpg

-20.3 KB
Loading

index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
],
160160

161161
'info' => [
162-
'version' => '2.3.6',
162+
'version' => '2.3.7',
163163
'homepage' => 'https://github.com/scottboms/kirby-applemusic',
164164
'license' => 'MIT',
165165
'authors' => [[ 'name' => 'Scott Boms' ]],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "scottboms/applemusic",
33
"description": "Apple Music Embed",
44
"author": "Scott Boms <[email protected]>",
5-
"version": "2.3.6",
5+
"version": "2.3.7",
66
"type": "kirby-plugin",
77
"license": "MIT",
88
"scripts": {

src/components/MusicKitHistory.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132

133133
<script>
134134
import { makeTrackOptions } from '../trackOptions';
135+
import missingArtwork from '../../assets/missing-artwork.jpg';
135136
136137
export default {
137138
name: 'Apple Music',
@@ -161,7 +162,9 @@ export default {
161162
searching: false,
162163
searchError: null,
163164
searchLimit: 10,
164-
_searchTimer: null
165+
_searchTimer: null,
166+
// missing artwork
167+
fallbackArtwork: missingArtwork,
165168
};
166169
},
167170
@@ -219,12 +222,14 @@ export default {
219222
? `https://music.apple.com/${storefront}/${pathSegment}/${encodeURIComponent(id)}`
220223
: null;
221224
225+
const imgSrc = image || this.fallbackArtwork;
226+
222227
const item = {
223228
id,
224229
text,
225230
info,
226231
icon: isAlbum ? 'album' : 'music',
227-
...(image ? { image: { src: image, ratio: '1/1', cover: true, back: 'pattern' } } : {})
232+
...(image ? { image: { src: imgSrc, ratio: '1/1', cover: true, back: 'pattern' } } : {})
228233
};
229234
230235
if (link) {
@@ -268,7 +273,7 @@ export default {
268273
text: this.trackTitle(item),
269274
info: this.artistName(item),
270275
image: {
271-
src: this.artworkUrl(item, 300) || undefined,
276+
src: this.artworkUrl(item, 300) || this.fallbackArtwork,
272277
ratio: '1/1',
273278
cover: true,
274279
back: 'pattern'

0 commit comments

Comments
 (0)