close #147
This commit is contained in:
commit
e6567d5f62
3 changed files with 3429 additions and 3316 deletions
|
@ -82,9 +82,9 @@
|
|||
}
|
||||
],
|
||||
"build": {
|
||||
"electronVersion": "16.0.6",
|
||||
"electronVersion": "16.0.7",
|
||||
"electronDownload": {
|
||||
"version": "16.0.6+wvcus",
|
||||
"version": "16.0.7+wvcus",
|
||||
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
||||
},
|
||||
"appId": "cider",
|
||||
|
|
|
@ -30,8 +30,10 @@ electron.app.on('ready', () => {
|
|||
console.info('[Cider] Running in development mode.')
|
||||
require('vue-devtools').install()
|
||||
}
|
||||
|
||||
electron.components.whenReady().then(() => {
|
||||
Cider.createWindow();
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -52,23 +54,27 @@ electron.app.on('before-quit', () => {
|
|||
console.warn(`${electron.app.getName()} exited.`);
|
||||
});
|
||||
//
|
||||
// // @ts-ignore
|
||||
// // Widevine Stuff
|
||||
// app.on('widevine-ready', (version, lastVersion) => {
|
||||
// electron.app.on('widevine-ready', (version, lastVersion) => {
|
||||
// if (null !== lastVersion) {
|
||||
// console.log('[Cider][Widevine] Widevine ' + version + ', upgraded from ' + lastVersion + ', is ready to be used!')
|
||||
// } else {
|
||||
// console.log('[Cider][Widevine] Widevine ' + version + ' is ready to be used!')
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
|
||||
|
||||
// // @ts-ignore
|
||||
// electron.app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
|
||||
// console.log('[Cider][Widevine] Widevine ' + currentVersion + ' is ready to be upgraded to ' + pendingVersion + '!')
|
||||
// })
|
||||
//
|
||||
// app.on('widevine-error', (error) => {
|
||||
|
||||
// // @ts-ignore
|
||||
// electron.app.on('widevine-error', (error) => {
|
||||
// console.log('[Cider][Widevine] Widevine installation encountered an error: ' + error)
|
||||
// app.exit()
|
||||
// electron.app.exit()
|
||||
// })
|
||||
|
||||
//
|
||||
//
|
||||
// app.on('open-url', (event, url) => {
|
||||
|
|
|
@ -366,9 +366,9 @@ const app = new Vue({
|
|||
},
|
||||
async showMenuPanel(data, event) {
|
||||
app.menuPanel.visible = true;
|
||||
app.menuPanel.content.name = data.name || "";
|
||||
app.menuPanel.content.items = data.items || {};
|
||||
app.menuPanel.content.headerItems = data.headerItems || {};
|
||||
app.menuPanel.content.name = data.name ? ? "";
|
||||
app.menuPanel.content.items = data.items ? ? {};
|
||||
app.menuPanel.content.headerItems = data.headerItems ? ? {};
|
||||
if (event) {
|
||||
app.menuPanel.event = event;
|
||||
}
|
||||
|
@ -646,8 +646,12 @@ const app = new Vue({
|
|||
|
||||
try {
|
||||
a = a.item.attributes;
|
||||
} catch (_) {}
|
||||
let type = (self.mk.nowPlayingItem != null) ? self.mk.nowPlayingItem["type"] || '' : '';
|
||||
} catch (_) {} <<
|
||||
<< << < HEAD
|
||||
let type = (self.mk.nowPlayingItem != null) ? self.mk.nowPlayingItem["type"] || '' : ''; ===
|
||||
=== =
|
||||
let type = (self.mk.nowPlayingItem != null) ? self.mk.nowPlayingItem["type"] ? ? '' : ''; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
|
||||
if (type.includes("musicVideo") || type.includes("uploadedVideo") || type.includes("music-movie")) {
|
||||
document.getElementById("apple-music-video-container").style.display = "block";
|
||||
|
@ -1083,8 +1087,12 @@ const app = new Vue({
|
|||
}
|
||||
let hash = route.split("/")
|
||||
let page = hash[0]
|
||||
let id = hash[1]
|
||||
let isLibrary = hash[2] || false
|
||||
let id = hash[1] <<
|
||||
<< << < HEAD
|
||||
let isLibrary = hash[2] || false ===
|
||||
=== =
|
||||
let isLibrary = hash[2] ? ? false >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
console.log(`page: ${page} id: ${id} isLibrary: ${isLibrary}`)
|
||||
this.routeView({
|
||||
kind: page,
|
||||
|
@ -1094,10 +1102,16 @@ const app = new Vue({
|
|||
}
|
||||
})
|
||||
},
|
||||
routeView(item) {
|
||||
routeView(item) { <<
|
||||
<< << < HEAD
|
||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind || (item.type || '')) : (item.type || ''));
|
||||
let id = (item.attributes.playParams ? (item.attributes.playParams.id || (item.id || '')) : (item.id || ''));;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary || false) : false;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary || false) : false; ===
|
||||
=== =
|
||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ? ? (item.type ? ? '')) : (item.type ? ? ''));
|
||||
let id = (item.attributes.playParams ? (item.attributes.playParams.id ? ? (item.id ? ? '')) : (item.id ? ? ''));;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ? ? false) : false; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
console.log(kind, id, isLibrary)
|
||||
|
||||
if (true) {
|
||||
|
@ -1139,8 +1153,12 @@ const app = new Vue({
|
|||
app.getTypeFromID((kind), (id), (isLibrary), params);
|
||||
window.location.hash = `${kind}/${id}${isLibrary ? "/" + isLibrary : ''}`
|
||||
document.querySelector("#app-content").scrollTop = 0
|
||||
} else {
|
||||
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url || '')
|
||||
} else { <<
|
||||
<< << < HEAD
|
||||
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url || '') ===
|
||||
=== =
|
||||
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ? ? '') >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1264,10 +1282,16 @@ const app = new Vue({
|
|||
this.getArtistFromID(id)
|
||||
//this.getTypeFromID("artist",id,isLibrary,query)
|
||||
},
|
||||
playMediaItem(item) {
|
||||
playMediaItem(item) { <<
|
||||
<< << < HEAD
|
||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind || (item.type || '')) : (item.type || ''));
|
||||
let id = (item.attributes.playParams ? (item.attributes.playParams.id || (item.id || '')) : (item.id || ''));;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary || false) : false;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary || false) : false; ===
|
||||
=== =
|
||||
let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ? ? (item.type ? ? '')) : (item.type ? ? ''));
|
||||
let id = (item.attributes.playParams ? (item.attributes.playParams.id ? ? (item.id ? ? '')) : (item.id ? ? ''));;
|
||||
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ? ? false) : false; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||
console.log(kind, id, isLibrary)
|
||||
app.mk.stop().then(() => {
|
||||
|
@ -1342,8 +1366,12 @@ const app = new Vue({
|
|||
// }
|
||||
// })
|
||||
// }
|
||||
else {
|
||||
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url || '')
|
||||
else { <<
|
||||
<< << < HEAD
|
||||
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url || '') ===
|
||||
=== =
|
||||
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ? ? '') >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -1995,8 +2023,12 @@ const app = new Vue({
|
|||
showSearch() {
|
||||
this.page = "search"
|
||||
},
|
||||
loadLyrics() {
|
||||
const musicType = (MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem["type"] || '' : '';
|
||||
loadLyrics() { <<
|
||||
<< << < HEAD
|
||||
const musicType = (MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem["type"] || '' : ''; ===
|
||||
=== =
|
||||
const musicType = (MusicKit.getInstance().nowPlayingItem != null) ? MusicKit.getInstance().nowPlayingItem["type"] ? ? '' : ''; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
console.log("mt", musicType)
|
||||
if (musicType === "musicVideo") {
|
||||
this.loadYTLyrics();
|
||||
|
@ -2008,8 +2040,12 @@ const app = new Vue({
|
|||
}
|
||||
}
|
||||
},
|
||||
loadAMLyrics() {
|
||||
const songID = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem["_songId"] || -1 : -1;
|
||||
loadAMLyrics() { <<
|
||||
<< << < HEAD
|
||||
const songID = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem["_songId"] || -1 : -1; ===
|
||||
=== =
|
||||
const songID = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem["_songId"] ? ? -1 : -1; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
// this.getMXM( trackName, artistName, 'en', duration);
|
||||
if (songID != -1) {
|
||||
MusicKit.getInstance().api.lyric(songID)
|
||||
|
@ -2036,15 +2072,25 @@ const app = new Vue({
|
|||
self.getLibrarySongsFull(true)
|
||||
})
|
||||
},
|
||||
async loadYTLyrics() {
|
||||
async loadYTLyrics() { <<
|
||||
<< << < HEAD
|
||||
const track = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title || '' : '';
|
||||
const artist = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName || '' : '';
|
||||
const time = (this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] || -1000) / 1000) || -1) : -1;
|
||||
const time = (this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] || -1000) / 1000) || -1) : -1; ===
|
||||
=== =
|
||||
const track = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title ? ? '' : '';
|
||||
const artist = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName ? ? '' : '';
|
||||
const time = (this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] ? ? -1000) / 1000) ? ? -1) : -1; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
ipcRenderer.invoke('getYTLyrics', track, artist).then((result) => {
|
||||
if (result.length > 0) {
|
||||
let ytid = result[0]['id']['videoId'];
|
||||
if (app.cfg.lyrics.enable_yt) {
|
||||
loadYT(ytid, app.cfg.lyrics.mxm_language || "en")
|
||||
if (app.cfg.lyrics.enable_yt) { <<
|
||||
<< << < HEAD
|
||||
loadYT(ytid, app.cfg.lyrics.mxm_language || "en") ===
|
||||
=== =
|
||||
loadYT(ytid, app.cfg.lyrics.mxm_language ? ? "en") >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
} else {
|
||||
app.loadMXM()
|
||||
}
|
||||
|
@ -2100,11 +2146,18 @@ const app = new Vue({
|
|||
|
||||
},
|
||||
loadMXM() {
|
||||
let attempt = 0;
|
||||
let attempt = 0; <<
|
||||
<< << < HEAD
|
||||
const track = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title || '' : '');
|
||||
const artist = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName || '' : '');
|
||||
const time = encodeURIComponent((this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] || -1000) / 1000) || -1) : -1);
|
||||
const id = encodeURIComponent((this.mk.nowPlayingItem != null) ? app.mk.nowPlayingItem._songId || '' : '');
|
||||
const id = encodeURIComponent((this.mk.nowPlayingItem != null) ? app.mk.nowPlayingItem._songId || '' : ''); ===
|
||||
=== =
|
||||
const track = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title ? ? '' : '');
|
||||
const artist = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName ? ? '' : '');
|
||||
const time = encodeURIComponent((this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] ? ? -1000) / 1000) ? ? -1) : -1);
|
||||
const id = encodeURIComponent((this.mk.nowPlayingItem != null) ? app.mk.nowPlayingItem._songId ? ? '' : ''); >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
let lrcfile = "";
|
||||
let richsync = [];
|
||||
const lang = app.cfg.lyrics.mxm_language // translation language
|
||||
|
@ -2126,8 +2179,12 @@ const app = new Vue({
|
|||
req.onload = function() {
|
||||
let jsonResponse = JSON.parse(this.responseText);
|
||||
let status2 = jsonResponse["message"]["header"]["status_code"];
|
||||
if (status2 == 200) {
|
||||
let token = jsonResponse["message"]["body"]["user_token"] || '';
|
||||
if (status2 == 200) { <<
|
||||
<< << < HEAD
|
||||
let token = jsonResponse["message"]["body"]["user_token"] || ''; ===
|
||||
=== =
|
||||
let token = jsonResponse["message"]["body"]["user_token"] ? ? ''; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
if (token != "" && token != "UpgradeOnlyUpgradeOnlyUpgradeOnlyUpgradeOnly") {
|
||||
console.log('200 token', mode);
|
||||
// token good
|
||||
|
@ -2174,8 +2231,12 @@ const app = new Vue({
|
|||
if (status1 == 200) {
|
||||
let id = '';
|
||||
try {
|
||||
if (jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["header"]["status_code"] == 200 && jsonResponse["message"]["body"]["macro_calls"]["track.subtitles.get"]["message"]["header"]["status_code"] == 200) {
|
||||
id = jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["body"]["track"]["track_id"] || '';
|
||||
if (jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["header"]["status_code"] == 200 && jsonResponse["message"]["body"]["macro_calls"]["track.subtitles.get"]["message"]["header"]["status_code"] == 200) { <<
|
||||
<< << < HEAD
|
||||
id = jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["body"]["track"]["track_id"] || ''; ===
|
||||
=== =
|
||||
id = jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["body"]["track"]["track_id"] ? ? ''; >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
lrcfile = jsonResponse["message"]["body"]["macro_calls"]["track.subtitles.get"]["message"]["body"]["subtitle_list"][0]["subtitle"]["subtitle_body"];
|
||||
|
||||
try {
|
||||
|
@ -2195,10 +2256,18 @@ const app = new Vue({
|
|||
let u = app.lyricsMediaItem.split(/[\r\n]/);
|
||||
let preLrc = []
|
||||
for (var i = u.length - 1; i >= 0; i--) {
|
||||
let xline = (/(\[[0-9.:\[\]]*\])+(.*)/).exec(u[i])
|
||||
let xline = (/(\[[0-9.:\[\]]*\])+(.*)/).exec(u[i]) <<
|
||||
<< << < HEAD
|
||||
let end = (preLrc.length > 0) ? ((preLrc[preLrc.length - 1].startTime) || 99999) : 99999
|
||||
preLrc.push({
|
||||
startTime: app.toMS(xline[1].substring(1, xline[1].length - 2)) || 0,
|
||||
===
|
||||
=== =
|
||||
let end = (preLrc.length > 0) ? ((preLrc[preLrc.length - 1].startTime) ? ? 99999) : 99999
|
||||
preLrc.push({
|
||||
startTime: app.toMS(xline[1].substring(1, xline[1].length - 2)) ? ? 0,
|
||||
>>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
endTime: end,
|
||||
line: xline[2],
|
||||
translation: ''
|
||||
|
@ -2210,9 +2279,9 @@ const app = new Vue({
|
|||
endTime: preLrc[preLrc.length - 1].startTime,
|
||||
line: "lrcInstrumental",
|
||||
translation: ''
|
||||
});
|
||||
app.lyrics = preLrc.reverse();
|
||||
} else {
|
||||
}); app.lyrics = preLrc.reverse();
|
||||
}
|
||||
else {
|
||||
preLrc = richsync.map(function(item) {
|
||||
return {
|
||||
startTime: item.ts,
|
||||
|
@ -2458,10 +2527,14 @@ const app = new Vue({
|
|||
if (childIndex != -1) {
|
||||
app.mk.changeToMediaAtIndex(childIndex)
|
||||
} else if (item) {
|
||||
app.mk.playNext({
|
||||
[item.attributes.playParams.kind || item.type]: item.attributes.playParams.id || item.id
|
||||
app.mk.playNext({ <<
|
||||
<< << < HEAD[item.attributes.playParams.kind || item.type]: item.attributes.playParams.id || item.id
|
||||
}).then(function() {
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) || 1)
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) || 1) ===
|
||||
=== = [item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id
|
||||
}).then(function() {
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1) >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
app.mk.play()
|
||||
})
|
||||
} else {
|
||||
|
@ -2472,10 +2545,14 @@ const app = new Vue({
|
|||
} else {
|
||||
app.mk.stop().then(() => {
|
||||
if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))) {
|
||||
app.mk.setQueue({
|
||||
[item.attributes.playParams.kind || item.type]: item.attributes.playParams.id || item.id
|
||||
app.mk.setQueue({ <<
|
||||
<< << < HEAD[item.attributes.playParams.kind || item.type]: item.attributes.playParams.id || item.id
|
||||
}).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() { ===
|
||||
=== = [item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id
|
||||
}).then(function() {
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1).then(function() { >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
if ((app.showingPlaylist && app.showingPlaylist.id == id)) {
|
||||
let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
||||
let u = query;
|
||||
|
@ -2506,10 +2583,14 @@ const app = new Vue({
|
|||
if (childIndex != -1) {
|
||||
app.mk.changeToMediaAtIndex(childIndex)
|
||||
} else if (item) {
|
||||
app.mk.playNext({
|
||||
[item.attributes.playParams.kind || item.type]: item.attributes.playParams.id || item.id
|
||||
app.mk.playNext({ <<
|
||||
<< << < HEAD[item.attributes.playParams.kind || item.type]: item.attributes.playParams.id || item.id
|
||||
}).then(function() {
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) || 1)
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) || 1) ===
|
||||
=== = [item.attributes.playParams.kind ? ? item.type]: item.attributes.playParams.id ? ? item.id
|
||||
}).then(function() {
|
||||
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ? ? 1) >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
app.mk.play()
|
||||
})
|
||||
} else {
|
||||
|
@ -2519,12 +2600,17 @@ const app = new Vue({
|
|||
}
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err)
|
||||
try {
|
||||
app.mk.stop()
|
||||
} catch (e) {}
|
||||
this.playMediaItemById(item.attributes.playParams.id || item.id, item.attributes.playParams.kind || item.type, item.attributes.playParams.isLibrary || false, item.attributes.url)
|
||||
} catch (e) {} <<
|
||||
<< << < HEAD
|
||||
this.playMediaItemById(item.attributes.playParams.id || item.id, item.attributes.playParams.kind || item.type, item.attributes.playParams.isLibrary || false, item.attributes.url) ===
|
||||
=== =
|
||||
this.playMediaItemById(item.attributes.playParams.id ? ? item.id, item.attributes.playParams.kind ? ? item.type, item.attributes.playParams.isLibrary ? ? false, item.attributes.url) >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -2621,8 +2707,12 @@ const app = new Vue({
|
|||
if (type.slice(-1) != "s") {
|
||||
type += "s"
|
||||
}
|
||||
type = type.replace("library-", "")
|
||||
let id = item.attributes.playParams.catalogId || item.id
|
||||
type = type.replace("library-", "") <<
|
||||
<< << < HEAD
|
||||
let id = item.attributes.playParams.catalogId || item.id ===
|
||||
=== =
|
||||
let id = item.attributes.playParams.catalogId ? ? item.id >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
|
||||
let index = types.findIndex(function(type) {
|
||||
return type.type == this
|
||||
|
@ -2804,16 +2894,24 @@ const app = new Vue({
|
|||
async getCurrentArtURL() {
|
||||
try {
|
||||
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 != '') {
|
||||
this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] || '').replace('{w}', 50).replace('{h}', 50);
|
||||
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 != '') { <<
|
||||
<< << < HEAD
|
||||
this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] || '').replace('{w}', 50).replace('{h}', 50); ===
|
||||
=== =
|
||||
this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] ? ? '').replace('{w}', 50).replace('{h}', 50); >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
try {
|
||||
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', `url("${this.currentArtUrl}")`);
|
||||
} catch (e) {}
|
||||
} else {
|
||||
let data = await this.mk.api.v3.music(`/v1/me/library/songs/${this.mk.nowPlayingItem.id}`);
|
||||
data = data.data.data[0];
|
||||
if (data != null && data !== "" && data.attributes != null && data.attributes.artwork != null) {
|
||||
this.currentArtUrl = (data["attributes"]["artwork"]["url"] || '').replace('{w}', 50).replace('{h}', 50);
|
||||
if (data != null && data !== "" && data.attributes != null && data.attributes.artwork != null) { <<
|
||||
<< << < HEAD
|
||||
this.currentArtUrl = (data["attributes"]["artwork"]["url"] || '').replace('{w}', 50).replace('{h}', 50); ===
|
||||
=== =
|
||||
this.currentArtUrl = (data["attributes"]["artwork"]["url"] ? ? '').replace('{w}', 50).replace('{h}', 50); >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
try {
|
||||
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', `url("${this.currentArtUrl}")`);
|
||||
} catch (e) {}
|
||||
|
@ -3013,9 +3111,14 @@ const app = new Vue({
|
|||
// return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);
|
||||
// }
|
||||
let self = this
|
||||
let data_type = this.mk.nowPlayingItem.playParams.kind
|
||||
let data_type = this.mk.nowPlayingItem.playParams.kind <<
|
||||
<< << < HEAD
|
||||
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 item_id = this.mk.nowPlayingItem.attributes.playParams.id ? ? this.mk.nowPlayingItem.id
|
||||
let isLibrary = this.mk.nowPlayingItem.attributes.playParams.isLibrary ? ? false >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
let params = { "fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "t": "1" }
|
||||
// let res = await app.mkapi(data_type, isLibrary , item_id, params);
|
||||
// if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
||||
|
@ -3172,8 +3275,12 @@ const app = new Vue({
|
|||
numbers.push(parseInt(item, 16))
|
||||
|
||||
}
|
||||
numbers.shift()
|
||||
let gain = Math.log10((Math.max(numbers[0], numbers[1]) || 1000) / 1000.0) * -10
|
||||
numbers.shift() <<
|
||||
<< << < HEAD
|
||||
let gain = Math.log10((Math.max(numbers[0], numbers[1]) || 1000) / 1000.0) * -10 ===
|
||||
=== =
|
||||
let gain = Math.log10((Math.max(numbers[0], numbers[1]) ? ? 1000) / 1000.0) * -10 >>>
|
||||
>>> > c7f180daf8cf1b2cdc35e1afde3b6c3ae98b7916
|
||||
let peak = Math.max(numbers[6], numbers[7]) / 32768.0
|
||||
return {
|
||||
gain: gain,
|
||||
|
@ -3215,9 +3322,9 @@ const app = new Vue({
|
|||
},
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Vue.component('animated-number', {
|
||||
Vue.component('animated-number', {
|
||||
|
||||
template: "<div style='display: inline-block;'>{{ displayNumber }}</div>",
|
||||
props: { 'number': { default: 0 } },
|
||||
|
@ -3250,9 +3357,9 @@ Vue.component('animated-number', {
|
|||
}, 20);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Vue.component('sidebar-library-item', {
|
||||
Vue.component('sidebar-library-item', {
|
||||
template: '#sidebar-library-item',
|
||||
props: {
|
||||
name: {
|
||||
|
@ -3285,29 +3392,29 @@ Vue.component('sidebar-library-item', {
|
|||
}
|
||||
},
|
||||
methods: {}
|
||||
});
|
||||
});
|
||||
|
||||
// Key binds
|
||||
document.addEventListener('keydown', function(e) {
|
||||
// Key binds
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.keyCode === 70 && e.ctrlKey) {
|
||||
app.$refs.searchInput.focus()
|
||||
app.$refs.searchInput.select()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Hang Timer
|
||||
app.hangtimer = setTimeout(() => {
|
||||
// Hang Timer
|
||||
app.hangtimer = setTimeout(() => {
|
||||
if (confirm("Cider is not responding. Reload the app?")) {
|
||||
window.location.reload()
|
||||
}
|
||||
}, 10000)
|
||||
}, 10000)
|
||||
|
||||
// add event listener for when window.location.hash changes
|
||||
window.addEventListener("hashchange", function() {
|
||||
// add event listener for when window.location.hash changes
|
||||
window.addEventListener("hashchange", function() {
|
||||
app.appRoute(window.location.hash)
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('musickitloaded', function() {
|
||||
document.addEventListener('musickitloaded', function() {
|
||||
// MusicKit global is now defined
|
||||
function initMusicKit() {
|
||||
let parsedJson = JSON.parse(this.responseText)
|
||||
|
@ -3367,16 +3474,16 @@ document.addEventListener('musickitloaded', function() {
|
|||
window.addEventListener("drmUnsupported", function() {
|
||||
initMusicKit()
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
if ('serviceWorker' in navigator) {
|
||||
// Use the window load event to keep the page load performant
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('sw.js?v=1');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const getBase64FromUrl = async(url) => {
|
||||
const getBase64FromUrl = async(url) => {
|
||||
const data = await fetch(url);
|
||||
const blob = await data.blob();
|
||||
return new Promise((resolve) => {
|
||||
|
@ -3387,28 +3494,28 @@ const getBase64FromUrl = async(url) => {
|
|||
resolve(base64data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function uuidv4() {
|
||||
function uuidv4() {
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function refreshFocus() {
|
||||
function refreshFocus() {
|
||||
if (document.hasFocus() == false) {
|
||||
app.windowFocus(false)
|
||||
} else {
|
||||
app.windowFocus(true)
|
||||
}
|
||||
setTimeout(refreshFocus, 200);
|
||||
}
|
||||
}
|
||||
|
||||
app.getHTMLStyle()
|
||||
app.getHTMLStyle()
|
||||
|
||||
refreshFocus();
|
||||
refreshFocus();
|
||||
|
||||
function xmlToJson(xml) {
|
||||
function xmlToJson(xml) {
|
||||
|
||||
// Create the return object
|
||||
let obj = {};
|
||||
|
@ -3445,15 +3552,15 @@ function xmlToJson(xml) {
|
|||
}
|
||||
console.log(obj);
|
||||
return obj;
|
||||
};
|
||||
};
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var checkIfScrollIsStatic = setInterval(() => {
|
||||
var checkIfScrollIsStatic = setInterval(() => {
|
||||
try {
|
||||
if (position === document.getElementsByClassName('lyric-body')[0].scrollTop) {
|
||||
clearInterval(checkIfScrollIsStatic)
|
||||
|
@ -3462,19 +3569,19 @@ var checkIfScrollIsStatic = setInterval(() => {
|
|||
position = document.getElementsByClassName('lyric-body')[0].scrollTop
|
||||
} catch (e) {}
|
||||
|
||||
}, 50);
|
||||
}, 50);
|
||||
|
||||
// WebGPU Console Notification
|
||||
async function webGPU() {
|
||||
// WebGPU Console Notification
|
||||
async function webGPU() {
|
||||
try {
|
||||
const currentGPU = await navigator.gpu.requestAdapter()
|
||||
console.log("WebGPU enabled on", currentGPU.name, "with feature ID", currentGPU.features.size)
|
||||
} catch (e) {
|
||||
console.log("WebGPU disabled / WebGPU initialization failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
webGPU().then()
|
||||
webGPU().then()
|
||||
|
||||
let screenWidth = screen.width;
|
||||
let screenHeight = screen.height;
|
||||
let screenWidth = screen.width;
|
||||
let screenHeight = screen.height;
|
Loading…
Add table
Add a link
Reference in a new issue