Merge branch 'main' into enhancement/radio

This commit is contained in:
Core 2022-05-25 03:08:48 +01:00
commit 6a86f78837
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
2 changed files with 579 additions and 557 deletions

View file

@ -52,6 +52,7 @@
"term.navigateForward": "Nyavigate fowwawd",
"term.play": "Pway",
"term.pause": "Pause",
"term.stop": "Stop",
"term.previous": "Pwevious",
"term.next": "Nyext",
"term.shuffle": "Shuffwe",
@ -257,6 +258,9 @@
"action.tray.minimize": "Minyimize to Tway",
"action.tray.quit": "Quit",
"action.tray.show": "Show Cidew",
"action.tray.playpause": "Pway/Pause",
"action.tray.next": "Nyext",
"action.tray.previous": "Pwevious",
"action.update": "Update",
"action.install": "Instaww",
"action.copy": "Copy",

View file

@ -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>
@ -109,20 +117,21 @@
},
methods: {
getBgColor() {
let color = `#${(this.item.attributes.artwork != null && this.item.attributes.artwork.bgColor != null) ? (this.item.attributes.artwork.bgColor) : ``}`
return color
return `#${(this.item.attributes.artwork != null && this.item.attributes.artwork.bgColor != null) ? (this.item.attributes.artwork.bgColor) : ``}`
},
getContextMenu(event) {
if (this.item.type == "artists") {
if (this.item.type === "artists") {
return this.artistMenu(event)
} else {
return this.contextMenu(event)
}
},
getSubtitle() {
if (this.kind == 'card') {
if (this.kind === 'card' || this.item.type === "playlists") {
try {
if (typeof this.item.attributes.artistNames != "undefined") {
if (typeof this.item.attributes.description.standard != "undefined") {
return this.item.attributes.description.standard
} else if (typeof this.item.attributes.artistNames != "undefined") {
return this.item.attributes.artistNames
} else if (typeof this.item.attributes.editorialNotes != "undefined") {
return this.item?.attributes?.editorialNotes?.short ?? (this.item.attributes?.editorialNotes?.name ?? '')
@ -131,7 +140,7 @@
} else {
return ''
}
}catch(e) {
} catch (e) {
return ''
}
} else {
@ -143,23 +152,19 @@
}
},
getSubtitleNavigation() {
if (this.kind == 'card') {
if (this.kind === 'card' || this.item.type === "playlists") {
try {
if (typeof this.item.attributes.artistNames != "undefined") {
return app.routeView(this.item)
} else if (typeof this.item.attributes.editorialNotes != "undefined") {
return app.routeView(this.item)
} else if (typeof this.item.attributes.artistName != "undefined") {
return app.searchAndNavigate(this.item,'artist')
if (typeof this.item.attributes.artistName != "undefined") {
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)
}
@ -185,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 {
@ -201,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() {
@ -244,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) {
@ -442,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)
}
}
}
]
@ -483,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
@ -498,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) {
}
@ -511,7 +529,7 @@
}
}
},
async artistMenu (event) {
async artistMenu(event) {
console.debug(this.item)
let self = this
let followAction = "follow"
@ -519,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)
@ -542,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()
})
}
@ -552,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))
}
}