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>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-rect" :class="{'info-rect-card': kind == 'card'}" :style="{'--bgartwork': getArtworkUrl(size, true)}">
|
<div class="info-rect" :class="{'info-rect-card': kind == 'card'}"
|
||||||
<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)'>
|
:style="{'--bgartwork': getArtworkUrl(size, true)}">
|
||||||
<div class="item-navigate text-overflow-elipsis">{{ item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? '')) }}</div>
|
<div class="title"
|
||||||
<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>
|
: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>
|
||||||
<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() != ''">
|
v-if="getSubtitle() != ''">
|
||||||
{{ getSubtitle() }}
|
{{ getSubtitle() }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -132,7 +140,7 @@
|
||||||
} else {
|
} else {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
}catch(e) {
|
} catch (e) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,16 +155,16 @@
|
||||||
if (this.kind === 'card' || this.item.type === "playlists") {
|
if (this.kind === 'card' || this.item.type === "playlists") {
|
||||||
try {
|
try {
|
||||||
if (typeof this.item.attributes.artistName != "undefined") {
|
if (typeof this.item.attributes.artistName != "undefined") {
|
||||||
return app.searchAndNavigate(this.item,'artist')
|
return app.searchAndNavigate(this.item, 'artist')
|
||||||
} else {
|
} else {
|
||||||
return app.routeView(this.item)
|
return app.routeView(this.item)
|
||||||
}
|
}
|
||||||
}catch(e) {
|
} catch (e) {
|
||||||
return app.routeView(this.item)
|
return app.routeView(this.item)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (typeof this.item.attributes.artistName != "undefined") {
|
if (typeof this.item.attributes.artistName != "undefined") {
|
||||||
return app.searchAndNavigate(this.item,'artist')
|
return app.searchAndNavigate(this.item, 'artist')
|
||||||
} else {
|
} else {
|
||||||
return app.routeView(this.item)
|
return app.routeView(this.item)
|
||||||
}
|
}
|
||||||
|
@ -182,14 +190,16 @@
|
||||||
async isInLibrary() {
|
async isInLibrary() {
|
||||||
if (this.item.type && !this.item.type.includes("library")) {
|
if (this.item.type && !this.item.type.includes("library")) {
|
||||||
let params = {
|
let params = {
|
||||||
relate:"library",
|
relate: "library",
|
||||||
"fields":"inLibrary",
|
"fields": "inLibrary",
|
||||||
"extend": this.revisedRandId()
|
"extend": this.revisedRandId()
|
||||||
}
|
}
|
||||||
let kind = this.item.type ?? this.item.attributes.playParams.kind
|
let kind = this.item.type ?? this.item.attributes.playParams.kind
|
||||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
if (truekind == "musicVideos") {truekind = "music-videos"}
|
if (truekind === "musicVideos") {
|
||||||
let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
|
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]
|
res = res.data.data[0]
|
||||||
this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
|
this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,24 +208,27 @@
|
||||||
},
|
},
|
||||||
async removeFromLibrary(id) {
|
async removeFromLibrary(id) {
|
||||||
let params = {
|
let params = {
|
||||||
relate:"library",
|
relate: "library",
|
||||||
"fields":"inLibrary",
|
"fields": "inLibrary",
|
||||||
"extend": this.revisedRandId()
|
"extend": this.revisedRandId()
|
||||||
}
|
}
|
||||||
let kind = this.item.type ?? this.item.attributes.playParams.kind
|
let kind = this.item.type ?? this.item.attributes.playParams.kind
|
||||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
if (truekind == "musicVideos") {truekind = "music-videos"}
|
if (truekind == "musicVideos") {
|
||||||
let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
|
truekind = "music-videos"
|
||||||
res= res.data.data[0]
|
}
|
||||||
|
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) {
|
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
||||||
id = res.relationships.library.data[0].id
|
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: {
|
fetchOptions: {
|
||||||
method: "DELETE"
|
method: "DELETE"
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
},
|
},
|
||||||
uuidv4() {
|
uuidv4() {
|
||||||
|
@ -241,12 +254,14 @@
|
||||||
},
|
},
|
||||||
getClasses() {
|
getClasses() {
|
||||||
let type = []
|
let type = []
|
||||||
try{
|
try {
|
||||||
type = this.item.type
|
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
|
type = this.kind
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -439,24 +454,30 @@
|
||||||
"icon": "./assets/feather/share.svg",
|
"icon": "./assets/feather/share.svg",
|
||||||
"name": app.getLz('action.share'),
|
"name": app.getLz('action.share'),
|
||||||
"action": function () {
|
"action": function () {
|
||||||
if (!self.item.attributes.url && self.item.relationships){
|
if (!self.item.attributes.url && self.item.relationships) {
|
||||||
if (self.item.relationships.catalog){
|
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)})
|
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 {
|
} else {
|
||||||
self.app.copyToClipboard(self.item.attributes.url)}
|
self.app.copyToClipboard(self.item.attributes.url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"icon": "./assets/feather/share.svg",
|
"icon": "./assets/feather/share.svg",
|
||||||
"name": `${app.getLz('action.share')} (song.link)`,
|
"name": `${app.getLz('action.share')} (song.link)`,
|
||||||
"action": function () {
|
"action": function () {
|
||||||
if (!self.item.attributes.url && self.item.relationships){
|
if (!self.item.attributes.url && self.item.relationships) {
|
||||||
if (self.item.relationships.catalog){
|
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)})
|
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 {
|
} 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)
|
let rating = await app.getRating(self.item)
|
||||||
if (rating == 0) {
|
if (rating == 0) {
|
||||||
menus.normal.headerItems.find(x => x.id == 'love').disabled = false
|
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 == 'undo_dislike').hidden = false
|
||||||
menus.normal.headerItems.find(x => x.id == 'dislike').hidden = true
|
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)
|
console.debug(this.item)
|
||||||
let self = this
|
let self = this
|
||||||
let followAction = "follow"
|
let followAction = "follow"
|
||||||
|
@ -516,14 +537,14 @@
|
||||||
follow: {
|
follow: {
|
||||||
icon: "./assets/feather/plus-circle.svg",
|
icon: "./assets/feather/plus-circle.svg",
|
||||||
name: app.getLz('action.follow'),
|
name: app.getLz('action.follow'),
|
||||||
action: ()=>{
|
action: () => {
|
||||||
self.app.cfg.home.followedArtists.push(this.item.id)
|
self.app.cfg.home.followedArtists.push(this.item.id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unfollow: {
|
unfollow: {
|
||||||
icon: "./assets/feather/x-circle.svg",
|
icon: "./assets/feather/x-circle.svg",
|
||||||
name: app.getLz('action.unfollow'),
|
name: app.getLz('action.unfollow'),
|
||||||
action: ()=>{
|
action: () => {
|
||||||
let index = self.app.cfg.home.followedArtists.indexOf(this.item.id)
|
let index = self.app.cfg.home.followedArtists.indexOf(this.item.id)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
self.app.cfg.home.followedArtists.splice(index, 1)
|
self.app.cfg.home.followedArtists.splice(index, 1)
|
||||||
|
@ -539,8 +560,8 @@
|
||||||
{
|
{
|
||||||
icon: "./assets/feather/play.svg",
|
icon: "./assets/feather/play.svg",
|
||||||
name: app.getLz('action.startRadio'),
|
name: app.getLz('action.startRadio'),
|
||||||
action: ()=>{
|
action: () => {
|
||||||
app.mk.setStationQueue({artist:this.item.id}).then(()=>{
|
app.mk.setStationQueue({artist: this.item.id}).then(() => {
|
||||||
app.mk.play()
|
app.mk.play()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -549,14 +570,14 @@
|
||||||
{
|
{
|
||||||
icon: "./assets/feather/share.svg",
|
icon: "./assets/feather/share.svg",
|
||||||
name: app.getLz('term.share'),
|
name: app.getLz('term.share'),
|
||||||
action: ()=>{
|
action: () => {
|
||||||
self.app.copyToClipboard(this.item.id.attributes.url)
|
self.app.copyToClipboard(this.item.id.attributes.url)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "./assets/feather/external-link.svg",
|
icon: "./assets/feather/external-link.svg",
|
||||||
name: app.getLz('action.openArtworkInBrowser'),
|
name: app.getLz('action.openArtworkInBrowser'),
|
||||||
action: ()=>{
|
action: () => {
|
||||||
window.open(app.getMediaItemArtwork(this.getArtworkUrl(), 1024, 1024))
|
window.open(app.getMediaItemArtwork(this.getArtworkUrl(), 1024, 1024))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue