Revert "Merge branch 'local' into develop"

This reverts commit 46ccfa1393, reversing
changes made to 8f9421258c.
This commit is contained in:
vapormusic 2022-02-26 06:21:17 +07:00
parent 46ccfa1393
commit 798a38613d
26 changed files with 158 additions and 205 deletions

View file

@ -10,7 +10,7 @@
</div>
<div class="artwork" @click='app.routeView(item)'>
<mediaitem-artwork
:url="mainimageurl"
:url="getArtworkUrl()"
: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,8 +77,7 @@
app: this.$root,
badges: this.$root.socialBadges.badgeMap,
itemBadges: [],
unavailable: false,
mainimageurl: '',
unavailable: false
}
},
async mounted() {
@ -92,7 +91,6 @@
this.unavailable = true
}
}
this.getMainImage()
},
methods: {
getBgColor() {
@ -152,7 +150,7 @@
let friends = this.badges[id]
if (friends) {
friends.forEach(function (friend) {
self.app.mk.api.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
self.itemBadges.push(data.data.data[0])
})
})
@ -172,7 +170,7 @@
let kind = this.item.type ?? this.item.attributes.playParams.kind
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
if (truekind == "musicVideos") {truekind = "music-videos"}
let res = await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
res = res.data.data[0]
this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
} else {
@ -188,13 +186,13 @@
let kind = this.item.type ?? this.item.attributes.playParams.kind
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
if (truekind == "musicVideos") {truekind = "music-videos"}
let res = await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
res= res.data.data[0]
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
id = res.relationships.library.data[0].id
}
app.mk.api.music(`v1/me/library/${truekind}/${id.toString()}`,{},
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
{
fetchOptions: {
method: "DELETE"
@ -207,10 +205,7 @@
);
},
getArtworkUrl(size = -1, includeUrl = false) {
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();
// }
let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : ''
if(size != -1) {
artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc"))
}
@ -225,12 +220,6 @@
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 != "") {