exposed profile artwork
This commit is contained in:
parent
df769b1f8d
commit
e46d290a15
1 changed files with 132 additions and 125 deletions
|
@ -297,10 +297,10 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
this.lz = ipcRenderer.sendSync("get-i18n", lang)
|
this.lz = ipcRenderer.sendSync("get-i18n", lang)
|
||||||
this.mklang = await this.MKJSLang()
|
this.mklang = await this.MKJSLang()
|
||||||
try{
|
try {
|
||||||
this.listennow.timestamp = 0;
|
this.listennow.timestamp = 0;
|
||||||
this.browsepage.timestamp = 0;
|
this.browsepage.timestamp = 0;
|
||||||
}catch(e){}
|
} catch (e) { }
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Grabs translation for localization.
|
* Grabs translation for localization.
|
||||||
|
@ -604,6 +604,11 @@ const app = new Vue({
|
||||||
try {
|
try {
|
||||||
// Set profile name
|
// Set profile name
|
||||||
this.chrome.userinfo = (await app.mk.api.v3.music(`/v1/me/social-profile`)).data.data[0]
|
this.chrome.userinfo = (await app.mk.api.v3.music(`/v1/me/social-profile`)).data.data[0]
|
||||||
|
// check if this.chrome.userinfo.attributes.artwork exists
|
||||||
|
if (this.chrome.userinfo.attributes.artwork) {
|
||||||
|
document.documentElement.style
|
||||||
|
.setProperty('--cvar-userprofileimg', `url("${this.getMediaItemArtwork(this.chrome.userinfo.attributes.artwork.url)}")`);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1421,15 +1426,15 @@ const app = new Vue({
|
||||||
const datetime = new Date(seconds * 1000)
|
const datetime = new Date(seconds * 1000)
|
||||||
|
|
||||||
if (format === "long") {
|
if (format === "long") {
|
||||||
const d = Math.floor(seconds / (3600*24));
|
const d = Math.floor(seconds / (3600 * 24));
|
||||||
const h = Math.floor(seconds % (3600*24) / 3600);
|
const h = Math.floor(seconds % (3600 * 24) / 3600);
|
||||||
const m = Math.floor(seconds % 3600 / 60);
|
const m = Math.floor(seconds % 3600 / 60);
|
||||||
const s = Math.floor(seconds % 60);
|
const s = Math.floor(seconds % 60);
|
||||||
|
|
||||||
const dDisplay = d > 0 ? `${d} ${app.getLz("term.time.day", {"count": d})}, ` : "";
|
const dDisplay = d > 0 ? `${d} ${app.getLz("term.time.day", { "count": d })}, ` : "";
|
||||||
const hDisplay = h > 0 ? `${h} ${app.getLz("term.time.hour", {"count": h})}, ` : "";
|
const hDisplay = h > 0 ? `${h} ${app.getLz("term.time.hour", { "count": h })}, ` : "";
|
||||||
const mDisplay = m > 0 ? `${m} ${app.getLz("term.time.minute", {"count": m})}, ` : "";
|
const mDisplay = m > 0 ? `${m} ${app.getLz("term.time.minute", { "count": m })}, ` : "";
|
||||||
const sDisplay = s > 0 ? `${s} ${app.getLz("term.time.second", {"count": s})}` : "";
|
const sDisplay = s > 0 ? `${s} ${app.getLz("term.time.second", { "count": s })}` : "";
|
||||||
|
|
||||||
return dDisplay + hDisplay + mDisplay + sDisplay;
|
return dDisplay + hDisplay + mDisplay + sDisplay;
|
||||||
}
|
}
|
||||||
|
@ -1486,7 +1491,7 @@ const app = new Vue({
|
||||||
let page = hash[0]
|
let page = hash[0]
|
||||||
let id = hash[1]
|
let id = hash[1]
|
||||||
let isLibrary = hash[2] ?? false
|
let isLibrary = hash[2] ?? false
|
||||||
if(page == "plugin") {
|
if (page == "plugin") {
|
||||||
this.pluginPages.page = "plugin." + id
|
this.pluginPages.page = "plugin." + id
|
||||||
this.page = "plugin-renderer"
|
this.page = "plugin-renderer"
|
||||||
return
|
return
|
||||||
|
@ -2323,8 +2328,8 @@ const app = new Vue({
|
||||||
getTotalTime() {
|
getTotalTime() {
|
||||||
try {
|
try {
|
||||||
if (app.showingPlaylist.relationships.tracks.data.length === 0) return ""
|
if (app.showingPlaylist.relationships.tracks.data.length === 0) return ""
|
||||||
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", {"count": app.showingPlaylist.relationships.tracks.data.length})}, ${app.convertTime(timeInSeconds, 'long')}`
|
return `${app.showingPlaylist.relationships.tracks.data.length} ${app.getLz("term.track", { "count": app.showingPlaylist.relationships.tracks.data.length })}, ${app.convertTime(timeInSeconds, 'long')}`
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -2598,7 +2603,7 @@ const app = new Vue({
|
||||||
req.open('GET', url, true);
|
req.open('GET', url, true);
|
||||||
req.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
req.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
||||||
req.onload = function () {
|
req.onload = function () {
|
||||||
try{
|
try {
|
||||||
let jsonResponse = JSON.parse(this.responseText);
|
let jsonResponse = JSON.parse(this.responseText);
|
||||||
let status2 = jsonResponse["message"]["header"]["status_code"];
|
let status2 = jsonResponse["message"]["header"]["status_code"];
|
||||||
if (status2 == 200) {
|
if (status2 == 200) {
|
||||||
|
@ -2621,7 +2626,7 @@ const app = new Vue({
|
||||||
// console.log('token 4xx');
|
// console.log('token 4xx');
|
||||||
getToken(mode, track, artist, songid, lang, time)
|
getToken(mode, track, artist, songid, lang, time)
|
||||||
}
|
}
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
console.log('error');
|
console.log('error');
|
||||||
app.loadAMLyrics();
|
app.loadAMLyrics();
|
||||||
}
|
}
|
||||||
|
@ -2645,7 +2650,7 @@ const app = new Vue({
|
||||||
req.open('GET', url, true);
|
req.open('GET', url, true);
|
||||||
req.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
req.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
||||||
req.onload = function () {
|
req.onload = function () {
|
||||||
try{
|
try {
|
||||||
let jsonResponse = JSON.parse(this.responseText);
|
let jsonResponse = JSON.parse(this.responseText);
|
||||||
console.log(jsonResponse);
|
console.log(jsonResponse);
|
||||||
let status1 = jsonResponse["message"]["header"]["status_code"];
|
let status1 = jsonResponse["message"]["header"]["status_code"];
|
||||||
|
@ -2723,7 +2728,8 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
} else { //4xx rejected
|
} else { //4xx rejected
|
||||||
getToken(1, track, artist, '', lang, time);
|
getToken(1, track, artist, '', lang, time);
|
||||||
}}catch(e){
|
}
|
||||||
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
app.loadAMLyrics()
|
app.loadAMLyrics()
|
||||||
}
|
}
|
||||||
|
@ -2744,7 +2750,7 @@ const app = new Vue({
|
||||||
req2.open('GET', url2, true);
|
req2.open('GET', url2, true);
|
||||||
req2.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
req2.setRequestHeader("authority", "apic-desktop.musixmatch.com");
|
||||||
req2.onload = function () {
|
req2.onload = function () {
|
||||||
try{
|
try {
|
||||||
let jsonResponse2 = JSON.parse(this.responseText);
|
let jsonResponse2 = JSON.parse(this.responseText);
|
||||||
console.log(jsonResponse2);
|
console.log(jsonResponse2);
|
||||||
let status2 = jsonResponse2["message"]["header"]["status_code"];
|
let status2 = jsonResponse2["message"]["header"]["status_code"];
|
||||||
|
@ -2770,7 +2776,8 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
} else { //4xx rejected
|
} else { //4xx rejected
|
||||||
getToken(2, '', '', id, lang, '');
|
getToken(2, '', '', id, lang, '');
|
||||||
}}catch(e){}
|
}
|
||||||
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
req2.send();
|
req2.send();
|
||||||
}
|
}
|
||||||
|
@ -3731,7 +3738,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(app.mk.nowPlayingItem._container["attributes"] && app.mk.nowPlayingItem._container.name != "station") {
|
if (app.mk.nowPlayingItem._container["attributes"] && app.mk.nowPlayingItem._container.name != "station") {
|
||||||
menus.normal.items.find(x => x.id == "showInMusic").hidden = false
|
menus.normal.items.find(x => x.id == "showInMusic").hidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue