added lcdArtworkSize directive
This commit is contained in:
parent
f800dc0a0a
commit
7de713ef7f
1 changed files with 199 additions and 195 deletions
|
@ -136,7 +136,7 @@ const app = new Vue({
|
||||||
sorting: "name",
|
sorting: "name",
|
||||||
sortOrder: "asc",
|
sortOrder: "asc",
|
||||||
listing: [],
|
listing: [],
|
||||||
meta: {total: 0, progress: 0},
|
meta: { total: 0, progress: 0 },
|
||||||
search: "",
|
search: "",
|
||||||
displayListing: [],
|
displayListing: [],
|
||||||
downloadState: 0 // 0 = not started, 1 = in progress, 2 = complete, 3 = empty library
|
downloadState: 0 // 0 = not started, 1 = in progress, 2 = complete, 3 = empty library
|
||||||
|
@ -152,7 +152,7 @@ const app = new Vue({
|
||||||
sorting: ["dateAdded", "name"], // [0] = recentlyadded page, [1] = albums page
|
sorting: ["dateAdded", "name"], // [0] = recentlyadded page, [1] = albums page
|
||||||
sortOrder: ["desc", "asc"], // [0] = recentlyadded page, [1] = albums page
|
sortOrder: ["desc", "asc"], // [0] = recentlyadded page, [1] = albums page
|
||||||
listing: [],
|
listing: [],
|
||||||
meta: {total: 0, progress: 0},
|
meta: { total: 0, progress: 0 },
|
||||||
search: "",
|
search: "",
|
||||||
displayListing: [],
|
displayListing: [],
|
||||||
downloadState: 0 // 0 = not started, 1 = in progress, 2 = complete, 3 = empty library
|
downloadState: 0 // 0 = not started, 1 = in progress, 2 = complete, 3 = empty library
|
||||||
|
@ -168,7 +168,7 @@ const app = new Vue({
|
||||||
sorting: ["dateAdded", "name"], // [0] = recentlyadded page, [1] = albums page
|
sorting: ["dateAdded", "name"], // [0] = recentlyadded page, [1] = albums page
|
||||||
sortOrder: ["desc", "asc"], // [0] = recentlyadded page, [1] = albums page
|
sortOrder: ["desc", "asc"], // [0] = recentlyadded page, [1] = albums page
|
||||||
listing: [],
|
listing: [],
|
||||||
meta: {total: 0, progress: 0},
|
meta: { total: 0, progress: 0 },
|
||||||
search: "",
|
search: "",
|
||||||
displayListing: [],
|
displayListing: [],
|
||||||
downloadState: 0 // 0 = not started, 1 = in progress, 2 = complete, 3 = empty library
|
downloadState: 0 // 0 = not started, 1 = in progress, 2 = complete, 3 = empty library
|
||||||
|
@ -222,7 +222,7 @@ const app = new Vue({
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"name": "Cider User",
|
"name": "Cider User",
|
||||||
"handle": "CiderUser",
|
"handle": "CiderUser",
|
||||||
"artwork": {"url": "./assets/logocut.png"}
|
"artwork": { "url": "./assets/logocut.png" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
menuOpened: false,
|
menuOpened: false,
|
||||||
|
@ -302,7 +302,7 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
songLinkShare(amUrl) {
|
songLinkShare(amUrl) {
|
||||||
notyf.open({type: "info", message: app.getLz('term.song.link.generate')})
|
notyf.open({ type: "info", message: app.getLz('term.song.link.generate') })
|
||||||
let self = this
|
let self = this
|
||||||
httpRequest = new XMLHttpRequest();
|
httpRequest = new XMLHttpRequest();
|
||||||
httpRequest.open('GET', `https://api.song.link/v1-alpha.1/links?url=${amUrl}&userCountry=US`, true);
|
httpRequest.open('GET', `https://api.song.link/v1-alpha.1/links?url=${amUrl}&userCountry=US`, true);
|
||||||
|
@ -397,7 +397,7 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
async showSocialListeningTo() {
|
async showSocialListeningTo() {
|
||||||
let contentIds = Object.keys(app.socialBadges.badgeMap)
|
let contentIds = Object.keys(app.socialBadges.badgeMap)
|
||||||
app.showCollection({data: this.socialBadges.mediaItems}, "Friends Listening To", "albums")
|
app.showCollection({ data: this.socialBadges.mediaItems }, "Friends Listening To", "albums")
|
||||||
if (this.socialBadges.mediaItemDLState == 1 || this.socialBadges.mediaItemDLState == 2) {
|
if (this.socialBadges.mediaItemDLState == 1 || this.socialBadges.mediaItemDLState == 2) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -526,7 +526,7 @@ const app = new Vue({
|
||||||
self.selectedMediaItems[i].kind = "albums"
|
self.selectedMediaItems[i].kind = "albums"
|
||||||
let res = await self.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/albums/${self.selectedMediaItems[i].id}/tracks`);
|
let res = await self.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/albums/${self.selectedMediaItems[i].id}/tracks`);
|
||||||
let ids = res.data.data.map(function (i) {
|
let ids = res.data.data.map(function (i) {
|
||||||
return {id: i.id, type: i.type}
|
return { id: i.id, type: i.type }
|
||||||
})
|
})
|
||||||
pl_items = pl_items.concat(ids)
|
pl_items = pl_items.concat(ids)
|
||||||
} else if (self.selectedMediaItems[i].kind == "library-song" || self.selectedMediaItems[i].kind == "library-songs") {
|
} else if (self.selectedMediaItems[i].kind == "library-song" || self.selectedMediaItems[i].kind == "library-songs") {
|
||||||
|
@ -539,7 +539,7 @@ const app = new Vue({
|
||||||
self.selectedMediaItems[i].kind = "library-albums"
|
self.selectedMediaItems[i].kind = "library-albums"
|
||||||
let res = await self.mk.api.v3.music(`/v1/me/library/albums/${self.selectedMediaItems[i].id}/tracks`);
|
let res = await self.mk.api.v3.music(`/v1/me/library/albums/${self.selectedMediaItems[i].id}/tracks`);
|
||||||
let ids = res.data.data.map(function (i) {
|
let ids = res.data.data.map(function (i) {
|
||||||
return {id: i.id, type: i.type}
|
return { id: i.id, type: i.type }
|
||||||
})
|
})
|
||||||
pl_items = pl_items.concat(ids)
|
pl_items = pl_items.concat(ids)
|
||||||
} else {
|
} else {
|
||||||
|
@ -566,7 +566,7 @@ const app = new Vue({
|
||||||
self.selectedMediaItems[i].kind = "albums"
|
self.selectedMediaItems[i].kind = "albums"
|
||||||
let res = await self.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/albums/${self.selectedMediaItems[i].id}/tracks`);
|
let res = await self.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/albums/${self.selectedMediaItems[i].id}/tracks`);
|
||||||
let ids = res.data.data.map(function (i) {
|
let ids = res.data.data.map(function (i) {
|
||||||
return {id: i.id, type: i.type}
|
return { id: i.id, type: i.type }
|
||||||
})
|
})
|
||||||
pl_items = pl_items.concat(ids)
|
pl_items = pl_items.concat(ids)
|
||||||
} else if (self.selectedMediaItems[i].kind == "library-song" || self.selectedMediaItems[i].kind == "library-songs") {
|
} else if (self.selectedMediaItems[i].kind == "library-song" || self.selectedMediaItems[i].kind == "library-songs") {
|
||||||
|
@ -579,7 +579,7 @@ const app = new Vue({
|
||||||
self.selectedMediaItems[i].kind = "library-albums"
|
self.selectedMediaItems[i].kind = "library-albums"
|
||||||
let res = await self.mk.api.v3.music(`/v1/me/library/albums/${self.selectedMediaItems[i].id}/tracks`);
|
let res = await self.mk.api.v3.music(`/v1/me/library/albums/${self.selectedMediaItems[i].id}/tracks`);
|
||||||
let ids = res.data.data.map(function (i) {
|
let ids = res.data.data.map(function (i) {
|
||||||
return {id: i.id, type: i.type}
|
return { id: i.id, type: i.type }
|
||||||
})
|
})
|
||||||
pl_items = pl_items.concat(ids)
|
pl_items = pl_items.concat(ids)
|
||||||
} else {
|
} else {
|
||||||
|
@ -654,7 +654,7 @@ const app = new Vue({
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"name": "Cider User",
|
"name": "Cider User",
|
||||||
"handle": "CiderUser",
|
"handle": "CiderUser",
|
||||||
"artwork": {"url": "./assets/logocut.png"}
|
"artwork": { "url": "./assets/logocut.png" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,7 @@ const app = new Vue({
|
||||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
app.mk.setQueue({
|
app.mk.setQueue({
|
||||||
[truekind]: [lastItem.attributes.playParams.id],
|
[truekind]: [lastItem.attributes.playParams.id],
|
||||||
parameters: {l: app.mklang}
|
parameters: { l: app.mklang }
|
||||||
})
|
})
|
||||||
app.mk.mute()
|
app.mk.mute()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -729,7 +729,7 @@ const app = new Vue({
|
||||||
for (id of ids) {
|
for (id of ids) {
|
||||||
if (!(i == 0 && ids[0] == lastItem.attributes.playParams.id)) {
|
if (!(i == 0 && ids[0] == lastItem.attributes.playParams.id)) {
|
||||||
try {
|
try {
|
||||||
app.mk.playLater({songs: [id]})
|
app.mk.playLater({ songs: [id] })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -751,14 +751,14 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "history":
|
case "history":
|
||||||
let history = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {l: app.mklang})
|
let history = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, { l: app.mklang })
|
||||||
if (history.data.data.length > 0) {
|
if (history.data.data.length > 0) {
|
||||||
let lastItem = history.data.data[0]
|
let lastItem = history.data.data[0]
|
||||||
let kind = lastItem.attributes.playParams.kind;
|
let kind = lastItem.attributes.playParams.kind;
|
||||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
app.mk.setQueue({
|
app.mk.setQueue({
|
||||||
[truekind]: [lastItem.attributes.playParams.id],
|
[truekind]: [lastItem.attributes.playParams.id],
|
||||||
parameters: {l: app.mklang}
|
parameters: { l: app.mklang }
|
||||||
})
|
})
|
||||||
app.mk.mute()
|
app.mk.mute()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -795,7 +795,7 @@ const app = new Vue({
|
||||||
|
|
||||||
ipcRenderer.on('play', function (_event, mode, id) {
|
ipcRenderer.on('play', function (_event, mode, id) {
|
||||||
if (mode !== 'url') {
|
if (mode !== 'url') {
|
||||||
self.mk.setQueue({[mode]: id, parameters: {l: self.mklang}}).then(() => {
|
self.mk.setQueue({ [mode]: id, parameters: { l: self.mklang } }).then(() => {
|
||||||
app.mk.play()
|
app.mk.play()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -919,14 +919,14 @@ const app = new Vue({
|
||||||
try {
|
try {
|
||||||
const infoResponse = await fetch("themes/" + app.cfg.visual.theme.replace("index.less", "theme.json"))
|
const infoResponse = await fetch("themes/" + app.cfg.visual.theme.replace("index.less", "theme.json"))
|
||||||
this.chrome.appliedTheme.info = await infoResponse.json()
|
this.chrome.appliedTheme.info = await infoResponse.json()
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
e=null
|
e = null
|
||||||
console.warn("failed to get theme.json")
|
console.warn("failed to get theme.json")
|
||||||
this.chrome.appliedTheme.info = {}
|
this.chrome.appliedTheme.info = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!onlyPrefs) {
|
if (!onlyPrefs) {
|
||||||
document.querySelector("#userTheme").href = `themes/${this.cfg.visual.theme}`
|
document.querySelector("#userTheme").href = `themes/${this.cfg.visual.theme}`
|
||||||
document.querySelectorAll(`[id*='less']`).forEach(el => {
|
document.querySelectorAll(`[id*='less']`).forEach(el => {
|
||||||
el.remove()
|
el.remove()
|
||||||
|
@ -935,10 +935,10 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getThemeDirective(directive = "") {
|
getThemeDirective(directive = "") {
|
||||||
if(typeof this.chrome.appliedTheme.info.directives != "object") {
|
if (typeof this.chrome.appliedTheme.info.directives != "object") {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if(this.chrome.appliedTheme.info.directives[directive]) {
|
if (this.chrome.appliedTheme.info.directives[directive]) {
|
||||||
return this.chrome.appliedTheme.info.directives[directive].value
|
return this.chrome.appliedTheme.info.directives[directive].value
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
|
@ -961,7 +961,7 @@ const app = new Vue({
|
||||||
classes.simplebg = true
|
classes.simplebg = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.getThemeDirective('windowLayout') == 'twopanel') {
|
if (this.getThemeDirective('windowLayout') == 'twopanel') {
|
||||||
classes.twopanel = true
|
classes.twopanel = true
|
||||||
}
|
}
|
||||||
return classes
|
return classes
|
||||||
|
@ -1060,7 +1060,7 @@ const app = new Vue({
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
attributes: {name: name}
|
attributes: { name: name }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1075,7 +1075,7 @@ const app = new Vue({
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
attributes: {name: name}
|
attributes: { name: name }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1103,9 +1103,9 @@ const app = new Vue({
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"attributes": {"name": name},
|
"attributes": { "name": name },
|
||||||
"relationships": {
|
"relationships": {
|
||||||
"tracks": {"data": tracks},
|
"tracks": { "data": tracks },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1155,7 +1155,7 @@ const app = new Vue({
|
||||||
app.appRoute("collection-list")
|
app.appRoute("collection-list")
|
||||||
},
|
},
|
||||||
async showArtistView(artist, title, view) {
|
async showArtistView(artist, title, view) {
|
||||||
let response = (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artist}/view/${view}?l=${this.mklang}`, {}, {includeResponseMeta: !0})).data
|
let response = (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artist}/view/${view}?l=${this.mklang}`, {}, { includeResponseMeta: !0 })).data
|
||||||
console.log(response)
|
console.log(response)
|
||||||
await this.showCollection(response, title, "artists")
|
await this.showCollection(response, title, "artists")
|
||||||
},
|
},
|
||||||
|
@ -1273,7 +1273,7 @@ const app = new Vue({
|
||||||
"limit[artists:top-songs]": 20,
|
"limit[artists:top-songs]": 20,
|
||||||
"art[url]": "f",
|
"art[url]": "f",
|
||||||
l: this.mklang
|
l: this.mklang
|
||||||
}, {includeResponseMeta: !0})
|
}, { includeResponseMeta: !0 })
|
||||||
console.log(artistData.data.data[0])
|
console.log(artistData.data.data[0])
|
||||||
this.artistPage.data = artistData.data.data[0]
|
this.artistPage.data = artistData.data.data[0]
|
||||||
this.page = "artist-page"
|
this.page = "artist-page"
|
||||||
|
@ -1379,17 +1379,17 @@ const app = new Vue({
|
||||||
|
|
||||||
// Minutes
|
// Minutes
|
||||||
if (time >= 60) {
|
if (time >= 60) {
|
||||||
longFormat.push(`${datetime.getMinutes()} ${app.getLz('term.time.minute', options = {count: datetime.getMinutes()})}`)
|
longFormat.push(`${datetime.getMinutes()} ${app.getLz('term.time.minute', options = { count: datetime.getMinutes() })}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hours
|
// Hours
|
||||||
if (time >= 3600) {
|
if (time >= 3600) {
|
||||||
longFormat.push(`${datetime.getHours()} ${app.getLz('term.time.hour', options = {count: datetime.getHours()})}`)
|
longFormat.push(`${datetime.getHours()} ${app.getLz('term.time.hour', options = { count: datetime.getHours() })}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Days
|
// Days
|
||||||
if (time >= 86400) {
|
if (time >= 86400) {
|
||||||
longFormat.push(`${day} ${app.getLz('term.time.day', options = {count: day})}`)
|
longFormat.push(`${day} ${app.getLz('term.time.day', options = { count: day })}`)
|
||||||
}
|
}
|
||||||
returnTime = longFormat.reverse().join(', ')
|
returnTime = longFormat.reverse().join(', ')
|
||||||
}
|
}
|
||||||
|
@ -1431,7 +1431,7 @@ const app = new Vue({
|
||||||
kind: page,
|
kind: page,
|
||||||
id: id,
|
id: id,
|
||||||
attributes: {
|
attributes: {
|
||||||
playParams: {kind: page, id: id, isLibrary: isLibrary}
|
playParams: { kind: page, id: id, isLibrary: isLibrary }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1536,7 +1536,7 @@ const app = new Vue({
|
||||||
let u = await app.mkapi(app.mk.nowPlayingItem.playParams.kind,
|
let u = await app.mkapi(app.mk.nowPlayingItem.playParams.kind,
|
||||||
(app.mk.nowPlayingItem.songId == -1),
|
(app.mk.nowPlayingItem.songId == -1),
|
||||||
(app.mk.nowPlayingItem.songId != -1) ? app.mk.nowPlayingItem.songId : app.mk.nowPlayingItem["id"],
|
(app.mk.nowPlayingItem.songId != -1) ? app.mk.nowPlayingItem.songId : app.mk.nowPlayingItem["id"],
|
||||||
{"include[songs]": "albums,artists", l: app.mklang});
|
{ "include[songs]": "albums,artists", l: app.mklang });
|
||||||
app.searchAndNavigate(u.data.data[0], target)
|
app.searchAndNavigate(u.data.data[0], target)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
app.searchAndNavigate(app.mk.nowPlayingItem, target)
|
app.searchAndNavigate(app.mk.nowPlayingItem, target)
|
||||||
|
@ -1640,7 +1640,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
if (labelId != "") {
|
if (labelId != "") {
|
||||||
app.showingPlaylist = []
|
app.showingPlaylist = []
|
||||||
await app.getTypeFromID("recordLabel", labelId, false, {views: 'top-releases,latest-releases,top-artists'});
|
await app.getTypeFromID("recordLabel", labelId, false, { views: 'top-releases,latest-releases,top-artists' });
|
||||||
app.page = "recordLabel_" + labelId;
|
app.page = "recordLabel_" + labelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1678,7 +1678,7 @@ const app = new Vue({
|
||||||
console.log(kind, id, isLibrary)
|
console.log(kind, id, isLibrary)
|
||||||
app.mk.stop().then(() => {
|
app.mk.stop().then(() => {
|
||||||
if (kind.includes("artist")) {
|
if (kind.includes("artist")) {
|
||||||
app.mk.setStationQueue({artist: 'a-' + id}).then(() => {
|
app.mk.setStationQueue({ artist: 'a-' + id }).then(() => {
|
||||||
app.mk.play()
|
app.mk.play()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1788,7 +1788,7 @@ const app = new Vue({
|
||||||
let self = this
|
let self = this
|
||||||
let prefs = this.cfg.libraryPrefs.songs
|
let prefs = this.cfg.libraryPrefs.songs
|
||||||
let albumAdded = self.library?.albums?.listing?.map(function (i) {
|
let albumAdded = self.library?.albums?.listing?.map(function (i) {
|
||||||
return {[i.id]: i.attributes?.dateAdded}
|
return { [i.id]: i.attributes?.dateAdded }
|
||||||
})
|
})
|
||||||
let startTime = new Date().getTime()
|
let startTime = new Date().getTime()
|
||||||
|
|
||||||
|
@ -2357,20 +2357,20 @@ const app = new Vue({
|
||||||
getTotalTime() {
|
getTotalTime() {
|
||||||
try {
|
try {
|
||||||
if (app.showingPlaylist.relationships.tracks.data.length > 0) {
|
if (app.showingPlaylist.relationships.tracks.data.length > 0) {
|
||||||
const timeInSeconds = Math.round([].concat(...app.showingPlaylist.relationships.tracks.data).reduce((a, {attributes: {durationInMillis}}) => a + durationInMillis, 0) / 1000);
|
const timeInSeconds = Math.round([].concat(...app.showingPlaylist.relationships.tracks.data).reduce((a, { attributes: { durationInMillis } }) => a + durationInMillis, 0) / 1000);
|
||||||
return `${app.showingPlaylist.relationships.tracks.data.length} ${app.getLz('term.track', options = {count: app.showingPlaylist.relationships.tracks.data.length})}, ${this.convertTime(timeInSeconds, 'long')}`
|
return `${app.showingPlaylist.relationships.tracks.data.length} ${app.getLz('term.track', options = { count: app.showingPlaylist.relationships.tracks.data.length })}, ${this.convertTime(timeInSeconds, 'long')}`
|
||||||
} else return ""
|
} else return ""
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getLibrarySongs() {
|
async getLibrarySongs() {
|
||||||
let response = await this.mkapi("songs", true, "", {limit: 100, l: this.mklang}, {includeResponseMeta: !0})
|
let response = await this.mkapi("songs", true, "", { limit: 100, l: this.mklang }, { includeResponseMeta: !0 })
|
||||||
this.library.songs.listing = response.data.data
|
this.library.songs.listing = response.data.data
|
||||||
this.library.songs.meta = response.data.meta
|
this.library.songs.meta = response.data.meta
|
||||||
},
|
},
|
||||||
async getLibraryAlbums() {
|
async getLibraryAlbums() {
|
||||||
let response = await this.mkapi("albums", true, "", {limit: 100, l: this.mklang}, {includeResponseMeta: !0})
|
let response = await this.mkapi("albums", true, "", { limit: 100, l: this.mklang }, { includeResponseMeta: !0 })
|
||||||
this.library.albums.listing = response.data.data
|
this.library.albums.listing = response.data.data
|
||||||
this.library.albums.meta = response.data.meta
|
this.library.albums.meta = response.data.meta
|
||||||
},
|
},
|
||||||
|
@ -2479,7 +2479,7 @@ const app = new Vue({
|
||||||
fetchOptions: {
|
fetchOptions: {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
attributes: {name: name}
|
attributes: { name: name }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2841,15 +2841,15 @@ const app = new Vue({
|
||||||
line: "lrcInstrumental"
|
line: "lrcInstrumental"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
preLrc.push({startTime: start, endTime: end, line: element.textContent});
|
preLrc.push({ startTime: start, endTime: end, line: element.textContent });
|
||||||
endTimes.push(end);
|
endTimes.push(end);
|
||||||
}
|
}
|
||||||
// first line dot
|
// first line dot
|
||||||
if (preLrc.length > 0)
|
if (preLrc.length > 0)
|
||||||
preLrc.unshift({startTime: 0, endTime: preLrc[0].startTime, line: "lrcInstrumental"});
|
preLrc.unshift({ startTime: 0, endTime: preLrc[0].startTime, line: "lrcInstrumental" });
|
||||||
} else {
|
} else {
|
||||||
for (element of lyricsLines) {
|
for (element of lyricsLines) {
|
||||||
preLrc.push({startTime: 9999999, endTime: 9999999, line: element.textContent});
|
preLrc.push({ startTime: 9999999, endTime: 9999999, line: element.textContent });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lyrics = preLrc;
|
this.lyrics = preLrc;
|
||||||
|
@ -2917,17 +2917,17 @@ const app = new Vue({
|
||||||
console.log(id, truekind, isLibrary)
|
console.log(id, truekind, isLibrary)
|
||||||
try {
|
try {
|
||||||
if (truekind.includes("artist")) {
|
if (truekind.includes("artist")) {
|
||||||
app.mk.setStationQueue({artist: 'a-' + id}).then(() => {
|
app.mk.setStationQueue({ artist: 'a-' + id }).then(() => {
|
||||||
app.mk.play()
|
app.mk.play()
|
||||||
})
|
})
|
||||||
} else if (truekind == "radioStations") {
|
} else if (truekind == "radioStations") {
|
||||||
this.mk.setStationQueue({url: raurl}).then(function (queue) {
|
this.mk.setStationQueue({ url: raurl }).then(function (queue) {
|
||||||
MusicKit.getInstance().play()
|
MusicKit.getInstance().play()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.mk.setQueue({
|
this.mk.setQueue({
|
||||||
[truekind]: [id],
|
[truekind]: [id],
|
||||||
parameters: {l: this.mklang}
|
parameters: { l: this.mklang }
|
||||||
}).then(function (queue) {
|
}).then(function (queue) {
|
||||||
MusicKit.getInstance().play()
|
MusicKit.getInstance().play()
|
||||||
})
|
})
|
||||||
|
@ -2968,7 +2968,7 @@ const app = new Vue({
|
||||||
if (item) {
|
if (item) {
|
||||||
app.mk.setQueue({
|
app.mk.setQueue({
|
||||||
[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id,
|
[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id,
|
||||||
parameters: {l: app.mklang}
|
parameters: { l: app.mklang }
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
app.mk.play().then(() => {
|
app.mk.play().then(() => {
|
||||||
if (app.mk.shuffleMode == 1) {
|
if (app.mk.shuffleMode == 1) {
|
||||||
|
@ -3025,7 +3025,7 @@ const app = new Vue({
|
||||||
for (let kind in itemsToPlay) {
|
for (let kind in itemsToPlay) {
|
||||||
let ids = itemsToPlay[kind]
|
let ids = itemsToPlay[kind]
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
app.mk.playLater({[kind + "s"]: itemsToPlay[kind]})
|
app.mk.playLater({ [kind + "s"]: itemsToPlay[kind] })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -3046,7 +3046,7 @@ const app = new Vue({
|
||||||
let ids = itemsToPlay[kind]
|
let ids = itemsToPlay[kind]
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
if (app.mk.queue._itemIDs.length > 0) {
|
if (app.mk.queue._itemIDs.length > 0) {
|
||||||
app.mk.playLater({[kind + "s"]: itemsToPlay[kind]}).then(function () {
|
app.mk.playLater({ [kind + "s"]: itemsToPlay[kind] }).then(function () {
|
||||||
ind += 1;
|
ind += 1;
|
||||||
console.log(ind, Object.keys(itemsToPlay).length)
|
console.log(ind, Object.keys(itemsToPlay).length)
|
||||||
if (ind >= Object.keys(itemsToPlay).length) {
|
if (ind >= Object.keys(itemsToPlay).length) {
|
||||||
|
@ -3055,7 +3055,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
app.mk.setQueue({[kind + "s"]: itemsToPlay[kind]}).then(function () {
|
app.mk.setQueue({ [kind + "s"]: itemsToPlay[kind] }).then(function () {
|
||||||
ind += 1;
|
ind += 1;
|
||||||
console.log(ind, Object.keys(itemsToPlay).length)
|
console.log(ind, Object.keys(itemsToPlay).length)
|
||||||
if (ind >= Object.keys(itemsToPlay).length) {
|
if (ind >= Object.keys(itemsToPlay).length) {
|
||||||
|
@ -3074,7 +3074,7 @@ const app = new Vue({
|
||||||
if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))) {
|
if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))) {
|
||||||
app.mk.setQueue({
|
app.mk.setQueue({
|
||||||
[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id,
|
[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id,
|
||||||
parameters: {l: app.mklang}
|
parameters: { l: app.mklang }
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1).then(function () {
|
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1).then(function () {
|
||||||
if ((app.showingPlaylist && app.showingPlaylist.id == id)) {
|
if ((app.showingPlaylist && app.showingPlaylist.id == id)) {
|
||||||
|
@ -3114,7 +3114,7 @@ const app = new Vue({
|
||||||
} else {
|
} else {
|
||||||
this.mk.setQueue({
|
this.mk.setQueue({
|
||||||
[truekind]: [id],
|
[truekind]: [id],
|
||||||
parameters: {l: this.mklang}
|
parameters: { l: this.mklang }
|
||||||
}).then(function (queue) {
|
}).then(function (queue) {
|
||||||
if (item && ((queue._itemIDs[childIndex] != item.id))) {
|
if (item && ((queue._itemIDs[childIndex] != item.id))) {
|
||||||
childIndex = queue._itemIDs.indexOf(item.id)
|
childIndex = queue._itemIDs.indexOf(item.id)
|
||||||
|
@ -3226,7 +3226,7 @@ const app = new Vue({
|
||||||
with: ["serverBubbles", "lyricSnippet"],
|
with: ["serverBubbles", "lyricSnippet"],
|
||||||
"art[url]": "f",
|
"art[url]": "f",
|
||||||
"art[social-profiles:url]": "c"
|
"art[social-profiles:url]": "c"
|
||||||
}, {includeResponseMeta: !0}).then(function (results) {
|
}, { includeResponseMeta: !0 }).then(function (results) {
|
||||||
results.data.results["meta"] = results.data.meta
|
results.data.results["meta"] = results.data.meta
|
||||||
self.search.resultsSocial = results.data.results
|
self.search.resultsSocial = results.data.results
|
||||||
})
|
})
|
||||||
|
@ -3246,7 +3246,7 @@ const app = new Vue({
|
||||||
return type.type == this
|
return type.type == this
|
||||||
}, type)
|
}, type)
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
types.push({type: type, id: [id]})
|
types.push({ type: type, id: [id] })
|
||||||
} else {
|
} else {
|
||||||
types[index].id.push(id)
|
types[index].id.push(id)
|
||||||
}
|
}
|
||||||
|
@ -3367,9 +3367,13 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
async getCurrentArtURL() {
|
async getCurrentArtURL() {
|
||||||
try {
|
try {
|
||||||
|
let artworkSize = 50
|
||||||
|
if (app.getThemeDirective("lcdArtworkSize") != "") {
|
||||||
|
artworkSize = app.getThemeDirective("lcdArtworkSize")
|
||||||
|
}
|
||||||
this.currentArtUrl = '';
|
this.currentArtUrl = '';
|
||||||
if (app.mk.nowPlayingItem != null && app.mk.nowPlayingItem.attributes != null && app.mk.nowPlayingItem.attributes.artwork != null && app.mk.nowPlayingItem.attributes.artwork.url != null && app.mk.nowPlayingItem.attributes.artwork.url != '') {
|
if (app.mk.nowPlayingItem != null && app.mk.nowPlayingItem.attributes != null && app.mk.nowPlayingItem.attributes.artwork != null && app.mk.nowPlayingItem.attributes.artwork.url != null && app.mk.nowPlayingItem.attributes.artwork.url != '') {
|
||||||
this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] ?? '').replace('{w}', 50).replace('{h}', 50);
|
this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] ?? '').replace('{w}', artworkSize).replace('{h}', artworkSize);
|
||||||
try {
|
try {
|
||||||
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', `url("${this.currentArtUrl}")`);
|
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', `url("${this.currentArtUrl}")`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -3378,7 +3382,7 @@ const app = new Vue({
|
||||||
let data = await this.mk.api.v3.music(`/v1/me/library/songs/${this.mk.nowPlayingItem.id}`);
|
let data = await this.mk.api.v3.music(`/v1/me/library/songs/${this.mk.nowPlayingItem.id}`);
|
||||||
data = data.data.data[0];
|
data = data.data.data[0];
|
||||||
if (data != null && data !== "" && data.attributes != null && data.attributes.artwork != null) {
|
if (data != null && data !== "" && data.attributes != null && data.attributes.artwork != null) {
|
||||||
this.currentArtUrl = (data["attributes"]["artwork"]["url"] ?? '').replace('{w}', 50).replace('{h}', 50);
|
this.currentArtUrl = (data["attributes"]["artwork"]["url"] ?? '').replace('{w}', artworkSize).replace('{h}', artworkSize);
|
||||||
ipcRenderer.send('updateRPCImage', this.currentArtUrl ?? '');
|
ipcRenderer.send('updateRPCImage', this.currentArtUrl ?? '');
|
||||||
try {
|
try {
|
||||||
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', `url("${this.currentArtUrl}")`);
|
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', `url("${this.currentArtUrl}")`);
|
||||||
|
@ -3430,10 +3434,10 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
quickPlay(query) {
|
quickPlay(query) {
|
||||||
let self = this
|
let self = this
|
||||||
MusicKit.getInstance().api.search(query, {limit: 2, types: 'songs'}).then(function (data) {
|
MusicKit.getInstance().api.search(query, { limit: 2, types: 'songs' }).then(function (data) {
|
||||||
MusicKit.getInstance().setQueue({
|
MusicKit.getInstance().setQueue({
|
||||||
song: data["songs"]['data'][0]["id"],
|
song: data["songs"]['data'][0]["id"],
|
||||||
parameters: {l: app.mklang}
|
parameters: { l: app.mklang }
|
||||||
}).then(function (queue) {
|
}).then(function (queue) {
|
||||||
MusicKit.getInstance().play()
|
MusicKit.getInstance().play()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -3611,7 +3615,7 @@ const app = new Vue({
|
||||||
let data_type = this.mk.nowPlayingItem.playParams.kind
|
let data_type = this.mk.nowPlayingItem.playParams.kind
|
||||||
let item_id = this.mk.nowPlayingItem.attributes.playParams.id ?? this.mk.nowPlayingItem.id
|
let item_id = this.mk.nowPlayingItem.attributes.playParams.id ?? this.mk.nowPlayingItem.id
|
||||||
let isLibrary = this.mk.nowPlayingItem.attributes.playParams.isLibrary ?? false
|
let isLibrary = this.mk.nowPlayingItem.attributes.playParams.isLibrary ?? false
|
||||||
let params = {"fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "t": "1"}
|
let params = { "fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "t": "1" }
|
||||||
app.selectedMediaItems = []
|
app.selectedMediaItems = []
|
||||||
app.select_selectMediaItem(item_id, data_type, 0, '12344', isLibrary)
|
app.select_selectMediaItem(item_id, data_type, 0, '12344', isLibrary)
|
||||||
let useMenu = "normal"
|
let useMenu = "normal"
|
||||||
|
@ -3691,7 +3695,7 @@ const app = new Vue({
|
||||||
"icon": "./assets/feather/radio.svg",
|
"icon": "./assets/feather/radio.svg",
|
||||||
"name": app.getLz('action.startRadio'),
|
"name": app.getLz('action.startRadio'),
|
||||||
"action": function () {
|
"action": function () {
|
||||||
app.mk.setStationQueue({song: app.mk.nowPlayingItem.id}).then(() => {
|
app.mk.setStationQueue({ song: app.mk.nowPlayingItem.id }).then(() => {
|
||||||
app.mk.play()
|
app.mk.play()
|
||||||
app.selectedMediaItems = []
|
app.selectedMediaItems = []
|
||||||
})
|
})
|
||||||
|
@ -4008,7 +4012,7 @@ const app = new Vue({
|
||||||
Vue.component('animated-number', {
|
Vue.component('animated-number', {
|
||||||
|
|
||||||
template: "<div style='display: inline-block;'>{{ displayNumber }}</div>",
|
template: "<div style='display: inline-block;'>{{ displayNumber }}</div>",
|
||||||
props: {'number': {default: 0}},
|
props: { 'number': { default: 0 } },
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue