formatted
This commit is contained in:
parent
ad570e969b
commit
df16909e1f
1 changed files with 570 additions and 549 deletions
|
@ -39,12 +39,20 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-rect" :class="{'info-rect-card': kind == 'card'}" :style="{'--bgartwork': getArtworkUrl(size, true)}">
|
||||
<div class="title" :title="item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? ''))" v-if="item.attributes.artistNames == null || kind != 'card'" @click='app.routeView(item)'>
|
||||
<div class="item-navigate text-overflow-elipsis">{{ item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? '')) }}</div>
|
||||
<div class="explicit-icon" v-if="item.attributes && item.attributes.contentRating == 'explicit'" style= "background-image: url(./assets/explicit.svg);height: 12px;width: 12px;filter: contrast(0);background-repeat: no-repeat;margin-top: 2.63px;margin-left: 4px;"></div>
|
||||
<div class="info-rect" :class="{'info-rect-card': kind == 'card'}"
|
||||
:style="{'--bgartwork': getArtworkUrl(size, true)}">
|
||||
<div class="title"
|
||||
:title="item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? ''))"
|
||||
v-if="item.attributes.artistNames == null || kind != 'card'" @click='app.routeView(item)'>
|
||||
<div class="item-navigate text-overflow-elipsis">{{ item.attributes?.name ??
|
||||
(item.relationships?.contents?.data[0]?.attributes?.name ??
|
||||
(item.attributes?.editorialNotes?.name ?? '')) }}
|
||||
</div>
|
||||
<div :title="getSubtitle()" class="subtitle item-navigate text-overflow-elipsis" @click="getSubtitleNavigation()"
|
||||
<div class="explicit-icon" v-if="item.attributes && item.attributes.contentRating == 'explicit'"
|
||||
style="background-image: url(./assets/explicit.svg);height: 12px;width: 12px;filter: contrast(0);background-repeat: no-repeat;margin-top: 2.63px;margin-left: 4px;"></div>
|
||||
</div>
|
||||
<div :title="getSubtitle()" class="subtitle item-navigate text-overflow-elipsis"
|
||||
@click="getSubtitleNavigation()"
|
||||
v-if="getSubtitle() != ''">
|
||||
{{ getSubtitle() }}
|
||||
</div>
|
||||
|
@ -132,7 +140,7 @@
|
|||
} else {
|
||||
return ''
|
||||
}
|
||||
}catch(e) {
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
|
@ -147,16 +155,16 @@
|
|||
if (this.kind === 'card' || this.item.type === "playlists") {
|
||||
try {
|
||||
if (typeof this.item.attributes.artistName != "undefined") {
|
||||
return app.searchAndNavigate(this.item,'artist')
|
||||
return app.searchAndNavigate(this.item, 'artist')
|
||||
} else {
|
||||
return app.routeView(this.item)
|
||||
}
|
||||
}catch(e) {
|
||||
} catch (e) {
|
||||
return app.routeView(this.item)
|
||||
}
|
||||
} else {
|
||||
if (typeof this.item.attributes.artistName != "undefined") {
|
||||
return app.searchAndNavigate(this.item,'artist')
|
||||
return app.searchAndNavigate(this.item, 'artist')
|
||||
} else {
|
||||
return app.routeView(this.item)
|
||||
}
|
||||
|
@ -182,14 +190,16 @@
|
|||
async isInLibrary() {
|
||||
if (this.item.type && !this.item.type.includes("library")) {
|
||||
let params = {
|
||||
relate:"library",
|
||||
"fields":"inLibrary",
|
||||
relate: "library",
|
||||
"fields": "inLibrary",
|
||||
"extend": this.revisedRandId()
|
||||
}
|
||||
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.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
|
||||
if (truekind === "musicVideos") {
|
||||
truekind = "music-videos"
|
||||
}
|
||||
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 {
|
||||
|
@ -198,24 +208,27 @@
|
|||
},
|
||||
async removeFromLibrary(id) {
|
||||
let params = {
|
||||
relate:"library",
|
||||
"fields":"inLibrary",
|
||||
relate: "library",
|
||||
"fields": "inLibrary",
|
||||
"extend": this.revisedRandId()
|
||||
}
|
||||
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.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
|
||||
res= res.data.data[0]
|
||||
if (truekind == "musicVideos") {
|
||||
truekind = "music-videos"
|
||||
}
|
||||
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.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
|
||||
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`, {},
|
||||
{
|
||||
fetchOptions: {
|
||||
method: "DELETE"
|
||||
}})
|
||||
}
|
||||
})
|
||||
this.addedToLibrary = true
|
||||
},
|
||||
uuidv4() {
|
||||
|
@ -241,12 +254,14 @@
|
|||
},
|
||||
getClasses() {
|
||||
let type = []
|
||||
try{
|
||||
try {
|
||||
type = this.item.type
|
||||
|
||||
}catch(e) {console.log('sd',this.item)}
|
||||
} catch (e) {
|
||||
console.log('sd', this.item)
|
||||
}
|
||||
|
||||
if (this.kind != "") {
|
||||
if (this.kind !== "") {
|
||||
type = this.kind
|
||||
}
|
||||
switch (type) {
|
||||
|
@ -439,24 +454,30 @@
|
|||
"icon": "./assets/feather/share.svg",
|
||||
"name": app.getLz('action.share'),
|
||||
"action": function () {
|
||||
if (!self.item.attributes.url && self.item.relationships){
|
||||
if (self.item.relationships.catalog){
|
||||
app.mkapi(self.item.attributes.playParams.kind, false, self.item.relationships.catalog.data[0].id).then(u => {self.app.copyToClipboard((u.data.data.length && u.data.data.length > 0)? u.data.data[0].attributes.url : u.data.data.attributes.url)})
|
||||
if (!self.item.attributes.url && self.item.relationships) {
|
||||
if (self.item.relationships.catalog) {
|
||||
app.mkapi(self.item.attributes.playParams.kind, false, self.item.relationships.catalog.data[0].id).then(u => {
|
||||
self.app.copyToClipboard((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
self.app.copyToClipboard(self.item.attributes.url)}
|
||||
self.app.copyToClipboard(self.item.attributes.url)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"icon": "./assets/feather/share.svg",
|
||||
"name": `${app.getLz('action.share')} (song.link)`,
|
||||
"action": function () {
|
||||
if (!self.item.attributes.url && self.item.relationships){
|
||||
if (self.item.relationships.catalog){
|
||||
app.mkapi(self.item.attributes.playParams.kind, false, self.item.relationships.catalog.data[0].id).then(u => {self.app.songLinkShare((u.data.data.length && u.data.data.length > 0)? u.data.data[0].attributes.url : u.data.data.attributes.url)})
|
||||
if (!self.item.attributes.url && self.item.relationships) {
|
||||
if (self.item.relationships.catalog) {
|
||||
app.mkapi(self.item.attributes.playParams.kind, false, self.item.relationships.catalog.data[0].id).then(u => {
|
||||
self.app.songLinkShare((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
self.app.songLinkShare(self.item.attributes.url)}
|
||||
self.app.songLinkShare(self.item.attributes.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -480,10 +501,10 @@
|
|||
}
|
||||
})
|
||||
|
||||
}catch(e) {
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
try{
|
||||
try {
|
||||
let rating = await app.getRating(self.item)
|
||||
if (rating == 0) {
|
||||
menus.normal.headerItems.find(x => x.id == 'love').disabled = false
|
||||
|
@ -495,7 +516,7 @@
|
|||
menus.normal.headerItems.find(x => x.id == 'undo_dislike').hidden = false
|
||||
menus.normal.headerItems.find(x => x.id == 'dislike').hidden = true
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -508,7 +529,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
async artistMenu (event) {
|
||||
async artistMenu(event) {
|
||||
console.debug(this.item)
|
||||
let self = this
|
||||
let followAction = "follow"
|
||||
|
@ -516,14 +537,14 @@
|
|||
follow: {
|
||||
icon: "./assets/feather/plus-circle.svg",
|
||||
name: app.getLz('action.follow'),
|
||||
action: ()=>{
|
||||
action: () => {
|
||||
self.app.cfg.home.followedArtists.push(this.item.id)
|
||||
}
|
||||
},
|
||||
unfollow: {
|
||||
icon: "./assets/feather/x-circle.svg",
|
||||
name: app.getLz('action.unfollow'),
|
||||
action: ()=>{
|
||||
action: () => {
|
||||
let index = self.app.cfg.home.followedArtists.indexOf(this.item.id)
|
||||
if (index > -1) {
|
||||
self.app.cfg.home.followedArtists.splice(index, 1)
|
||||
|
@ -539,8 +560,8 @@
|
|||
{
|
||||
icon: "./assets/feather/play.svg",
|
||||
name: app.getLz('action.startRadio'),
|
||||
action: ()=>{
|
||||
app.mk.setStationQueue({artist:this.item.id}).then(()=>{
|
||||
action: () => {
|
||||
app.mk.setStationQueue({artist: this.item.id}).then(() => {
|
||||
app.mk.play()
|
||||
})
|
||||
}
|
||||
|
@ -549,14 +570,14 @@
|
|||
{
|
||||
icon: "./assets/feather/share.svg",
|
||||
name: app.getLz('term.share'),
|
||||
action: ()=>{
|
||||
action: () => {
|
||||
self.app.copyToClipboard(this.item.id.attributes.url)
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: "./assets/feather/external-link.svg",
|
||||
name: app.getLz('action.openArtworkInBrowser'),
|
||||
action: ()=>{
|
||||
action: () => {
|
||||
window.open(app.getMediaItemArtwork(this.getArtworkUrl(), 1024, 1024))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue