add artist images back

This commit is contained in:
vapormusic 2022-02-25 07:19:04 +07:00
parent 76f640a088
commit a2f82d65d7
4 changed files with 51 additions and 10 deletions

View file

@ -10,7 +10,7 @@
</div>
<div class="artwork" @click='app.routeView(item)'>
<mediaitem-artwork
:url="getArtworkUrl()"
:url="mainimageurl"
:video="(item.attributes != null && item.attributes.editorialVideo != null) ? (item.attributes.editorialVideo.motionDetailSquare ? item.attributes.editorialVideo.motionDetailSquare.video : (item.attributes.editorialVideo.motionSquareVideo1x1 ? item.attributes.editorialVideo.motionSquareVideo1x1.video : '')) : '' "
:size="size"
shadow="subtle"
@ -77,7 +77,8 @@
app: this.$root,
badges: this.$root.socialBadges.badgeMap,
itemBadges: [],
unavailable: false
unavailable: false,
mainimageurl: '',
}
},
async mounted() {
@ -91,6 +92,7 @@
this.unavailable = true
}
}
this.getMainImage()
},
methods: {
getBgColor() {
@ -205,7 +207,10 @@
);
},
getArtworkUrl(size = -1, includeUrl = false) {
let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : ''
let artwork = this.item.attributes?.artwork ? this.item.attributes.artwork?.url : ''
// if (artwork == '' && this.item.type == "artists" && this.item.id != null) {
// artwork = (await app.loadArtistImage(this.item.id)).toString();
// }
if(size != -1) {
artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc"))
}
@ -220,6 +225,12 @@
return `url("${artwork}")`
}
},
async getMainImage(){
this.mainimageurl = this.getArtworkUrl()
if (this.mainimageurl == '' && this.item.id != null && this.item.type == "artists") {
this.mainimageurl = await this.app.loadArtistImage(this.item.id)
}
},
getClasses() {
let type = this.item.type
if (this.kind != "") {