diff --git a/src/renderer/index.js b/src/renderer/index.js index 12c6e192..c9c7834c 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -3911,6 +3911,21 @@ const app = new Vue({ checkForUpdate() { ipcRenderer.send('check-for-update') }, + async loadArtistImage(id){ + try { + let u = await fetch(`https://music.apple.com/${app.mk.storefrontId}/artist/${id}`); + let html = await u.text(); + function getStringBetween(str, start, end) { + const result = str.match(new RegExp(start + "(.*)" + end)); + + return result[1]; + } + let string = getStringBetween(html, '
- +
{{ item.attributes.name }} @@ -16,24 +16,30 @@ props: { item: { type: Object, - required: true + required: true, } }, data: function() { return { artist: { id: null - } + }, + artistimage : '' } }, template: '#artist-chip', async mounted() { - let artistId = this.item.id + let artistId = this.item.id + if(typeof this.item.relationships.catalog == "object") { artistId = this.item.relationships.catalog.data[0].id } - app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(response => { + app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(async (response) => { this.artist = response.data.data[0]; + if (this.artistimage == '' && artistId != null){ + this.artistimage = (await this.$root.loadArtistImage(artistId) ?? '').replace('300x300','50x50') + + } }); }, methods: { diff --git a/src/renderer/views/components/mediaitem-square.ejs b/src/renderer/views/components/mediaitem-square.ejs index eb0569de..fbf8983c 100644 --- a/src/renderer/views/components/mediaitem-square.ejs +++ b/src/renderer/views/components/mediaitem-square.ejs @@ -10,7 +10,7 @@