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

@ -1,7 +1,7 @@
<script type="text/x-template" id="artist-chip">
<div class="artist-chip" @click.self="route">
<div class="artist-chip__image">
<mediaitem-artwork v-if="artist.id != null" :url="artistimage" :size="32"></mediaitem-artwork>
<mediaitem-artwork v-if="artist.id != null" :url="artist.attributes.artwork.url" :size="32"></mediaitem-artwork>
</div>
<div class="artist-chip__name">
<span>{{ item.attributes.name }}</span>
@ -16,30 +16,24 @@
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(async (response) => {
app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(response => {
this.artist = response.data.data[0];
if (this.artistimage == '' && artistId != null){
this.artistimage = (await this.$root.loadArtistImage(artistId) ?? '').replace('300x300','50x50')
}
});
},
methods: {

View file

@ -58,8 +58,8 @@
},
async select(e) {
let u = this.item
let u1 = await app.mk.api.music(`/v1/me/library/artists/${u.id}/albums`, {
platform: "auto",
let u1 = await app.mk.api.v3.music(`/v1/me/library/artists/${u.id}/albums`, {
"platform": "web",
"include[library-albums]": "artists,tracks",
"include[library-artists]": "catalog",
"fields[artists]": "url",

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="listennow-child">
<div v-observe-visibility="{callback: visibilityChanged}">
<template v-if="isVisible && recom.attributes.display?.kind != 'MusicSuperHeroShelf'">
<template v-if="isVisible && recom.attributes.display.kind != 'MusicSuperHeroShelf'">
<div class="row">
<div class="col">
<h3>{{ recom.attributes.title ? recom.attributes.title.stringForDisplay : ""}}</h3>
@ -9,7 +9,7 @@
<button class="cd-btn-seeall" @click="app.showCollection(recom.relationships.contents, recom.attributes.title ? recom.attributes.title.stringForDisplay : '', 'listen_now')" >{{app.getLz('term.seeAll')}}</button>
</div>
</div>
<template v-if="!recom.id.startsWith('6-') && index != 0">
<template v-if="recom.attributes.display.kind == 'MusicCoverShelf'">
<mediaitem-scroller-horizontal-large
:items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-large>
</template>
@ -18,7 +18,7 @@
:items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-sp>
</template>
</template>
<template v-else-if="recom.attributes.display?.kind != 'MusicSuperHeroShelf'">
<template v-else-if="recom.attributes.display.kind != 'MusicSuperHeroShelf'">
<div style="height:330px"> </div>
</template>
@ -27,11 +27,11 @@
<script>
Vue.component('listennow-child', {
template: "#listennow-child",
props: ["recom", "index"],
props: ["recom"],
data: function () {
return {
isVisible: true,
app: this.$root,
app: this.$root
}
},
methods: {

View file

@ -539,8 +539,8 @@
var playlistId = id
function getPlaylist(id, isLibrary) {
if (isLibrary) {
return this.app.mk.api.music(`/v1/me/library/playlists/${id}`)
} else { return this.app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`) }
return this.app.mk.api.v3.music(`/v1/me/library/playlists/${id}`)
} else { return this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`) }
}
try {
getPlaylist(id, isLibrary).then(res => {

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 != "") {

View file

@ -66,7 +66,7 @@
},
methods: {
async getHistory() {
let history = await app.mk.api.music(`/v1/me/recent/played/tracks`, { l : this.$root.mklang})
let history = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, { l : this.$root.mklang})
this.history = history.data.data
},
select(e, position) {

View file

@ -88,7 +88,7 @@
console.log(sendTo)
let type = item.type.replace("library-", "")
let typeTo = sendTo.type
this.$root.mk.api.music(`/v1/me/library/${type}/${item.id}/parent`, {}, {
this.$root.mk.api.v3.music(`/v1/me/library/${type}/${item.id}/parent`, {}, {
fetchOptions: {
method: "PUT",
body: JSON.stringify({
@ -197,7 +197,7 @@
this.getChildren()
this.toggleFolder()
this.$root.mk.api.music(`v1/me/library/playlist-folders/${item.id}/children`).then(data => {
this.$root.mk.api.v3.music(`v1/me/library/playlist-folders/${item.id}/children`).then(data => {
let children = data.data.data;
children.forEach(child => {
if(!self.$root.playlists.listing.find(listing => listing.id == child.id)) {