Merge branch 'develop' of https://github.com/ciderapp/Cider into develop

This commit is contained in:
vapormusic 2022-02-24 10:58:59 +07:00
commit 0875c4eaa8
6 changed files with 320 additions and 253 deletions

View file

@ -46,6 +46,10 @@ app.on('ready', () => {
const bw = new BrowserWindow() const bw = new BrowserWindow()
const win = await bw.createWindow() const win = await bw.createWindow()
app.getGPUInfo("complete").then(gpuInfo => {
console.log(gpuInfo)
})
console.log('[Cider][Widevine] Status:', components.status()); console.log('[Cider][Widevine] Status:', components.status());
win.on("ready-to-show", () => { win.on("ready-to-show", () => {

View file

@ -20,7 +20,8 @@ const CiderFrontAPI = {
MenuEntry: function () { MenuEntry: function () {
this.id = "" this.id = ""
this.name = "" this.name = ""
this.onClick = () => { } this.onClick = () => {
}
} }
}, },
AddMenuEntry(entry) { AddMenuEntry(entry) {
@ -136,7 +137,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 +153,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 +169,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
@ -218,7 +219,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,
@ -298,7 +299,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);
@ -354,7 +355,9 @@ const app = new Vue({
// fallback English plural forms ( old i18n ) // fallback English plural forms ( old i18n )
if (options["count"] > 1) { if (options["count"] > 1) {
return this.lz[message + "s"] ?? this.lz[message] return this.lz[message + "s"] ?? this.lz[message]
} else { return this.lz[message] ?? this.lz[message + "s"] } } else {
return this.lz[message] ?? this.lz[message + "s"]
}
} }
} else if (typeof this.lz[message] === "object") { } else if (typeof this.lz[message] === "object") {
return (this.lz[message])[Object.keys(this.lz[message])[0]] return (this.lz[message])[Object.keys(this.lz[message])[0]]
@ -391,7 +394,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
} }
@ -520,7 +523,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") {
@ -533,7 +536,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 {
@ -560,7 +563,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") {
@ -573,7 +576,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 {
@ -587,13 +590,13 @@ const app = new Vue({
this.modals.addToPlaylist = false this.modals.addToPlaylist = false
await app.mk.api.v3.music( await app.mk.api.v3.music(
`/v1/me/library/playlists/${playlist_id}/tracks`, {}, { `/v1/me/library/playlists/${playlist_id}/tracks`, {}, {
fetchOptions: { fetchOptions: {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
data: pl_items data: pl_items
}) })
}
} }
}
).then(() => { ).then(() => {
if (this.page == 'playlist_' + this.showingPlaylist.id) { if (this.page == 'playlist_' + this.showingPlaylist.id) {
this.getPlaylistFromID(this.showingPlaylist.id, true) this.getPlaylistFromID(this.showingPlaylist.id, true)
@ -648,7 +651,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"}
} }
} }
} }
@ -704,7 +707,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(() => {
@ -723,7 +726,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) {
} }
} }
@ -745,14 +748,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(() => {
@ -776,12 +779,13 @@ const app = new Vue({
let replaygain = self.parseSCTagToRG(tag) let replaygain = self.parseSCTagToRG(tag)
try { try {
CiderAudio.audioNodes.gainNode.gain.value = (Math.min(Math.pow(10, (replaygain.gain / 20)), (1 / replaygain.peak))) CiderAudio.audioNodes.gainNode.gain.value = (Math.min(Math.pow(10, (replaygain.gain / 20)), (1 / replaygain.peak)))
} catch (e) { } } catch (e) {
}
}) })
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()
}) })
@ -1001,12 +1005,12 @@ const app = new Vue({
this.newPlaylist() this.newPlaylist()
} }
}, },
{ {
name: app.getLz('term.createNewPlaylistFolder'), name: app.getLz('term.createNewPlaylistFolder'),
action: () => { action: () => {
this.newPlaylistFolder() this.newPlaylistFolder()
}
} }
}
] ]
} }
this.showMenuPanel(menu, event) this.showMenuPanel(menu, event)
@ -1015,13 +1019,13 @@ const app = new Vue({
let self = this let self = this
this.mk.api.v3.music( this.mk.api.v3.music(
`/v1/me/library/playlist-folders/${id}`, {}, { `/v1/me/library/playlist-folders/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "PATCH", method: "PATCH",
body: JSON.stringify({ body: JSON.stringify({
attributes: { name: name } attributes: {name: name}
}) })
}
} }
}
).then(res => { ).then(res => {
self.refreshPlaylists() self.refreshPlaylists()
}) })
@ -1030,13 +1034,13 @@ const app = new Vue({
let self = this let self = this
this.mk.api.v3.music( this.mk.api.v3.music(
`/v1/me/library/playlists/${id}`, {}, { `/v1/me/library/playlists/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "PATCH", method: "PATCH",
body: JSON.stringify({ body: JSON.stringify({
attributes: { name: name } attributes: {name: name}
}) })
}
} }
}
).then(res => { ).then(res => {
self.refreshPlaylists() self.refreshPlaylists()
}) })
@ -1061,9 +1065,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},
} }
}) })
} }
@ -1113,7 +1117,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")
}, },
@ -1231,7 +1235,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"
@ -1346,7 +1350,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}
} }
}) })
}, },
@ -1429,11 +1433,19 @@ const app = new Vue({
prevButton() { prevButton() {
if (!app.prevButtonBackIndicator && app.mk.nowPlayingItem && app.mk.currentPlaybackTime > 2) { if (!app.prevButtonBackIndicator && app.mk.nowPlayingItem && app.mk.currentPlaybackTime > 2) {
app.prevButtonBackIndicator = true; app.prevButtonBackIndicator = true;
try { clearTimeout(app.pauseButtonTimer) } catch (e) { } try {
clearTimeout(app.pauseButtonTimer)
} catch (e) {
}
app.mk.seekToTime(0); app.mk.seekToTime(0);
app.pauseButtonTimer = setTimeout(() => { app.prevButtonBackIndicator = false }, 3000); app.pauseButtonTimer = setTimeout(() => {
app.prevButtonBackIndicator = false
}, 3000);
} else { } else {
try { clearTimeout(app.pauseButtonTimer) } catch (e) { } try {
clearTimeout(app.pauseButtonTimer)
} catch (e) {
}
app.prevButtonBackIndicator = false; app.prevButtonBackIndicator = false;
app.skipToPreviousItem() app.skipToPreviousItem()
} }
@ -1443,7 +1455,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)
@ -1547,7 +1559,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;
} }
@ -1571,75 +1583,75 @@ 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()
}) })
} }
// else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ // else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){
// /* Randomize array in-place using Durstenfeld shuffle algorithm */ // /* Randomize array in-place using Durstenfeld shuffle algorithm */
// function shuffleArray(array) { // function shuffleArray(array) {
// for (var i = array.length - 1; i > 0; i--) { // for (var i = array.length - 1; i > 0; i--) {
// var j = Math.floor(Math.random() * (i + 1)); // var j = Math.floor(Math.random() * (i + 1));
// var temp = array[i]; // var temp = array[i];
// array[i] = array[j]; // array[i] = array[j];
// array[j] = temp; // array[j] = temp;
// } // }
// } // }
// app.mk.clearQueue().then(function () { { // app.mk.clearQueue().then(function () { {
// app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { // app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () {
// app.mk.play().then(function (){ // app.mk.play().then(function (){
// app.mk.clearQueue().then(function (){ // app.mk.clearQueue().then(function (){
// var playlistId = id // var playlistId = id
// const params = { // const params = {
// include: "tracks", // include: "tracks",
// platform: "web", // platform: "web",
// "include[library-playlists]": "catalog,tracks", // "include[library-playlists]": "catalog,tracks",
// "fields[playlists]": "curatorName,playlistType,name,artwork,url", // "fields[playlists]": "curatorName,playlistType,name,artwork,url",
// "include[library-songs]": "catalog,artists,albums", // "include[library-songs]": "catalog,artists,albums",
// "fields[catalog]": "artistUrl,albumUrl", // "fields[catalog]": "artistUrl,albumUrl",
// "fields[songs]": "artistUrl,albumUrl" // "fields[songs]": "artistUrl,albumUrl"
// } // }
// var playlistId = '' // var playlistId = ''
// try { // try {
// function getPlaylist(id, params, isLibrary){ // function getPlaylist(id, params, isLibrary){
// if (isLibrary){ // if (isLibrary){
// return app.mk.api.library.playlist(id, params) // return app.mk.api.library.playlist(id, params)
// } else { return app.mk.api.playlist(id, params)} // } else { return app.mk.api.playlist(id, params)}
// } // }
// getPlaylist(id, params, isLibrary).then(res => { // getPlaylist(id, params, isLibrary).then(res => {
// let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); // let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
// if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} // if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')}
// app.mk.queue.append(query) // app.mk.queue.append(query)
// if (!res.relationships.tracks.next) { // if (!res.relationships.tracks.next) {
// return // return
// } else { // } else {
// getPlaylistTracks(res.relationships.tracks.next) // getPlaylistTracks(res.relationships.tracks.next)
// } // }
// function getPlaylistTracks(next) { // function getPlaylistTracks(next) {
// app.apiCall(app.musicBaseUrl + next, res => { // app.apiCall(app.musicBaseUrl + next, res => {
// if (res.id != playlistId) { // if (res.id != playlistId) {
// return // return
// } // }
// let query = res.data.map(item => new MusicKit.MediaItem(item)) // let query = res.data.map(item => new MusicKit.MediaItem(item))
// if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} // if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')}
// app.mk.queue.append(query) // app.mk.queue.append(query)
// if (res.next) { // if (res.next) {
// getPlaylistTracks(res.next) // getPlaylistTracks(res.next)
// } // }
// }) // })
// } // }
// }) // })
// } catch (e) {} // } catch (e) {}
// }) // })
// }) // })
// }) // })
// } // }
// }) // })
// } // }
else { else {
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ?? '') app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ?? '')
@ -1680,8 +1692,11 @@ const app = new Vue({
searchLibrarySongs() { searchLibrarySongs() {
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) { return { [i.id]: i.attributes?.dateAdded } }) let albumAdded = self.library?.albums?.listing?.map(function (i) {
return {[i.id]: i.attributes?.dateAdded}
})
let startTime = new Date().getTime() let startTime = new Date().getTime()
function sortSongs() { function sortSongs() {
// sort this.library.songs.displayListing by song.attributes[self.library.songs.sorting] in descending or ascending order based on alphabetical order and numeric order // sort this.library.songs.displayListing by song.attributes[self.library.songs.sorting] in descending or ascending order based on alphabetical order and numeric order
// check if song.attributes[self.library.songs.sorting] is a number and if so, sort by number if not, sort by alphabetical order ignoring case // check if song.attributes[self.library.songs.sorting] is a number and if so, sort by number if not, sort by alphabetical order ignoring case
@ -2119,7 +2134,7 @@ const app = new Vue({
} }
if (downloaded.meta.total > library.length || typeof downloaded.meta.next != "undefined") { if (downloaded.meta.total > library.length || typeof downloaded.meta.next != "undefined") {
console.log(`downloading next chunk - ${library.length console.log(`downloading next chunk - ${library.length
} albums so far`) } albums so far`)
downloadChunk() downloadChunk()
} else { } else {
self.library.albums.listing = library self.library.albums.listing = library
@ -2226,7 +2241,7 @@ const app = new Vue({
} }
if (downloaded.meta.total > library.length || typeof downloaded.meta.next != "undefined") { if (downloaded.meta.total > library.length || typeof downloaded.meta.next != "undefined") {
console.log(`downloading next chunk - ${library.length console.log(`downloading next chunk - ${library.length
} artists so far`) } artists so far`)
downloadChunk() downloadChunk()
} else { } else {
self.library.artists.listing = library self.library.artists.listing = library
@ -2243,26 +2258,26 @@ const app = new Vue({
getTotalTime() { getTotalTime() {
try { try {
if (app.showingPlaylist.relationships.tracks.data.length > 0) { if (app.showingPlaylist.relationships.tracks.data.length > 0) {
let time = Math.round([].concat(...app.showingPlaylist.relationships.tracks.data).reduce((a, { attributes: { durationInMillis } }) => a + durationInMillis, 0) / 1000); let time = Math.round([].concat(...app.showingPlaylist.relationships.tracks.data).reduce((a, {attributes: {durationInMillis}}) => a + durationInMillis, 0) / 1000);
let hours = Math.floor(time / 3600) let hours = Math.floor(time / 3600)
let mins = Math.floor(time / 60) % 60 let mins = Math.floor(time / 60) % 60
let secs = time % 60 let secs = time % 60
return app.showingPlaylist.relationships.tracks.data.length + " " + app.getLz('term.tracks', options = { count: app.showingPlaylist.relationships.tracks.data.length }) + ", " return app.showingPlaylist.relationships.tracks.data.length + " " + app.getLz('term.tracks', options = {count: app.showingPlaylist.relationships.tracks.data.length}) + ", "
+ ((hours > 0) ? (hours + (" " + (app.getLz('term.time.hour', options = { count: hours }) + ", "))) : "") + + ((hours > 0) ? (hours + (" " + (app.getLz('term.time.hour', options = {count: hours}) + ", "))) : "") +
((mins > 0) ? (mins + (" " + app.getLz('term.time.minute', options = { count: mins }) + ", ")) : "") + ((mins > 0) ? (mins + (" " + app.getLz('term.time.minute', options = {count: mins}) + ", ")) : "") +
secs + (" " + app.getLz('term.time.second', options = { count: secs }) + "."); secs + (" " + app.getLz('term.time.second', options = {count: secs}) + ".");
} 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
}, },
@ -2368,13 +2383,13 @@ const app = new Vue({
let self = this let self = this
this.mk.api.v3.music( this.mk.api.v3.music(
"/v1/me/library/playlist-folders/", {}, { "/v1/me/library/playlist-folders/", {}, {
fetchOptions: { fetchOptions: {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
attributes: { name: name } attributes: {name: name}
}) })
}
} }
}
).then((res) => { ).then((res) => {
let playlist = (res.data.data[0]) let playlist = (res.data.data[0])
self.playlists.listing.push({ self.playlists.listing.push({
@ -2733,15 +2748,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;
@ -2809,17 +2824,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()
}) })
@ -2860,7 +2875,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) {
@ -2902,7 +2917,8 @@ const app = new Vue({
let u = data.map(x => x.id) let u = data.map(x => x.id)
try { try {
data.splice(u.indexOf(item.attributes.playParams.id ?? item.id), 1) data.splice(u.indexOf(item.attributes.playParams.id ?? item.id), 1)
} catch (e) { } } catch (e) {
}
if (app.mk.shuffleMode == 1) { if (app.mk.shuffleMode == 1) {
shuffleArray(data) shuffleArray(data)
} }
@ -2916,7 +2932,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]})
} }
} }
}) })
@ -2937,22 +2953,22 @@ 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) {
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.attributes.playParams.id ?? item.id)) app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.attributes.playParams.id ?? item.id))
}
} }
}
) )
} 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) {
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.attributes.playParams.id ?? item.id)) app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.attributes.playParams.id ?? item.id))
}
} }
}
) )
} }
} }
@ -2960,13 +2976,12 @@ const app = new Vue({
} }
} }
}) })
} } else {
else {
app.mk.stop().then(() => { app.mk.stop().then(() => {
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)) {
@ -3006,7 +3021,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)
@ -3118,7 +3133,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
}) })
@ -3138,7 +3153,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)
} }
@ -3322,8 +3337,11 @@ 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({ song: data["songs"]['data'][0]["id"], parameters: { l: app.mklang } }).then(function (queue) { MusicKit.getInstance().setQueue({
song: data["songs"]['data'][0]["id"],
parameters: {l: app.mklang}
}).then(function (queue) {
MusicKit.getInstance().play() MusicKit.getInstance().play()
setTimeout(() => { setTimeout(() => {
self.$forceUpdate() self.$forceUpdate()
@ -3500,7 +3518,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"
@ -3519,81 +3537,105 @@ const app = new Vue({
app.love(app.mk.nowPlayingItem) app.love(app.mk.nowPlayingItem)
} }
}, },
{ {
"icon": "./assets/feather/heart.svg", "icon": "./assets/feather/heart.svg",
"id": "unlove", "id": "unlove",
"active": true, "active": true,
"name": app.getLz('action.unlove'), "name": app.getLz('action.unlove'),
"hidden": true, "hidden": true,
"action": function () { "action": function () {
app.unlove(app.mk.nowPlayingItem) app.unlove(app.mk.nowPlayingItem)
} }
}, },
{ {
"icon": "./assets/feather/thumbs-down.svg", "icon": "./assets/feather/thumbs-down.svg",
"id": "dislike", "id": "dislike",
"name": app.getLz('action.dislike'), "name": app.getLz('action.dislike'),
"hidden": false, "hidden": false,
"disabled": true, "disabled": true,
"action": function () { "action": function () {
app.dislike(app.mk.nowPlayingItem) app.dislike(app.mk.nowPlayingItem)
} }
}, },
{ {
"icon": "./assets/feather/thumbs-down.svg", "icon": "./assets/feather/thumbs-down.svg",
"id": "undo_dislike", "id": "undo_dislike",
"name": app.getLz('action.undoDislike'), "name": app.getLz('action.undoDislike'),
"active": true, "active": true,
"hidden": true, "hidden": true,
"action": function () { "action": function () {
app.unlove(app.mk.nowPlayingItem) app.unlove(app.mk.nowPlayingItem)
} }
}, },
], ],
items: [{ items: [
"icon": "./assets/feather/list.svg", {
"name": app.getLz('action.addToPlaylist') + " ...", "icon": "./assets/feather/plus.svg",
"action": function () { "id": "addToLibrary",
app.promptAddToPlaylist() "name": app.getLz('action.addToLibrary') + " ...",
"disabled": true,
"action": function () {
app.addToLibrary(app.mk.nowPlayingItem.id);
}
},
{
"id": "removeFromLibrary",
"icon": "./assets/feather/x-circle.svg",
"name": app.getLz('action.removeFromLibrary'),
"hidden": true,
"action": function () {
self.removeFromLibrary()
}
},
{
"icon": "./assets/feather/list.svg",
"name": app.getLz('action.addToPlaylist') + " ...",
"action": function () {
app.promptAddToPlaylist()
}
},
{
"icon": "./assets/feather/radio.svg",
"name": app.getLz('action.startRadio'),
"action": function () {
app.mk.setStationQueue({song: app.mk.nowPlayingItem.id}).then(() => {
app.mk.play()
app.selectedMediaItems = []
})
}
},
{
"icon": "./assets/feather/user.svg",
"name": app.getLz('action.goToArtist'),
"action": function () {
app.appRoute(`artist/${app.mk.nowPlayingItem.relationships.artists.data[0].id}`)
}
},
{
"icon": "./assets/feather/disc.svg",
"name": app.getLz('action.goToAlbum'),
"action": function () {
app.appRoute(`album/${app.mk.nowPlayingItem.relationships.albums.data[0].id}`)
}
},
{
"icon": "./assets/feather/share.svg",
"name": app.getLz('action.share'),
"action": function () {
app.mkapi(app.mk.nowPlayingItem.attributes?.playParams?.kind ?? app.mk.nowPlayingItem.type ?? 'songs', false, app.mk.nowPlayingItem._songId ?? (app.mk.nowPlayingItem.songId ?? app.mk.nowPlayingItem.id) ?? '').then(u => {
app.copyToClipboard((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url)
})
}
},
{
"icon": "./assets/feather/share.svg",
"name": `${app.getLz('action.share')} (song.link)`,
"action": function () {
app.mkapi(app.mk.nowPlayingItem.attributes?.playParams?.kind ?? app.mk.nowPlayingItem.type ?? 'songs', false, app.mk.nowPlayingItem._songId ?? (app.mk.nowPlayingItem.songId ?? app.mk.nowPlayingItem.id) ?? '').then(u => {
app.songLinkShare((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url)
})
}
} }
},
{
"icon": "./assets/feather/plus.svg",
"id": "addToLibrary",
"name": app.getLz('action.addToLibrary') + " ...",
"disabled": false,
"action": function () {
app.addToLibrary(app.mk.nowPlayingItem.id);
}
},
{
"icon": "./assets/feather/radio.svg",
"name": app.getLz('action.startRadio'),
"action": function () {
app.mk.setStationQueue({ song: app.mk.nowPlayingItem.id }).then(() => {
app.mk.play()
app.selectedMediaItems = []
})
}
},
{
"icon": "./assets/feather/share.svg",
"name": app.getLz('action.share'),
"action": function () {
app.mkapi(app.mk.nowPlayingItem.attributes?.playParams?.kind ?? app.mk.nowPlayingItem.type ?? 'songs', false, app.mk.nowPlayingItem._songId ?? (app.mk.nowPlayingItem.songId ?? app.mk.nowPlayingItem.id) ?? '').then(u => {
app.copyToClipboard((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url)
})
}
},
{
"icon": "./assets/feather/share.svg",
"name": `${app.getLz('action.share')} (song.link)`,
"action": function () {
app.mkapi(app.mk.nowPlayingItem.attributes?.playParams?.kind ?? app.mk.nowPlayingItem.type ?? 'songs', false, app.mk.nowPlayingItem._songId ?? (app.mk.nowPlayingItem.songId ?? app.mk.nowPlayingItem.id) ?? '').then(u => {
app.songLinkShare((u.data.data.length && u.data.data.length > 0) ? u.data.data[0].attributes.url : u.data.data.attributes.url)
})
}
}
] ]
} }
} }
@ -3604,6 +3646,18 @@ const app = new Vue({
} }
this.showMenuPanel(menus[useMenu], event) this.showMenuPanel(menus[useMenu], event)
try {
let result = await this.inLibrary([this.mk.nowPlayingItem])
if (result[0].attributes.inLibrary) {
menus.normal.items.find(x => x.id == 'addToLibrary').hidden = true
menus.normal.items.find(x => x.id == 'removeFromLibrary').hidden = false
} else {
menus.normal.items.find(x => x.id == 'addToLibrary').disabled = false
}
} catch (e) {
e = null
}
try { try {
let rating = await app.getRating(app.mk.nowPlayingItem) let rating = await app.getRating(app.mk.nowPlayingItem)
if (rating == 0) { if (rating == 0) {
@ -3789,7 +3843,9 @@ const app = new Vue({
try { try {
let item = await MusicKit.getInstance().api.v3.music(`v1/storefronts/${app.mk.storefrontId}`) let item = await MusicKit.getInstance().api.v3.music(`v1/storefronts/${app.mk.storefrontId}`)
let langcodes = item.data.data[0].attributes.supportedLanguageTags; let langcodes = item.data.data[0].attributes.supportedLanguageTags;
if (langcodes) langcodes = langcodes.map(function (u) { return u.replace(/-Han[s|t]/i, "").toLowerCase() }) if (langcodes) langcodes = langcodes.map(function (u) {
return u.replace(/-Han[s|t]/i, "").toLowerCase()
})
console.log(langcodes) console.log(langcodes)
let sellang = "" let sellang = ""
if (u && langcodes.includes(u.toLowerCase().replace('_', "-"))) { if (u && langcodes.includes(u.toLowerCase().replace('_', "-"))) {
@ -3805,8 +3861,7 @@ const app = new Vue({
console.log(sellang) console.log(sellang)
return await sellang return await sellang
} } catch (err) {
catch (err) {
console.log('locale err', err) console.log('locale err', err)
let langcodes = ['af', 'sq', 'ar', 'eu', 'bg', 'be', 'ca', 'zh', 'zh-tw', 'zh-cn', 'zh-hk', 'zh-sg', 'hr', 'cs', 'da', 'nl', 'nl-be', 'en', 'en-us', 'en-eg', 'en-au', 'en-gb', 'en-ca', 'en-nz', 'en-ie', 'en-za', 'en-jm', 'en-bz', 'en-tt', 'en-001', 'et', 'fo', 'fa', 'fi', 'fr', 'fr-ca', 'gd', 'de', 'de-ch', 'el', 'he', 'hi', 'hu', 'is', 'id', 'it', 'ja', 'ko', 'lv', 'lt', 'mk', 'mt', 'no', 'nb', 'nn', 'pl', 'pt-br', 'pt', 'rm', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'es-mx', 'es-419', 'sv', 'th', 'ts', 'tn', 'tr', 'uk', 'ur', 've', 'vi', 'xh', 'yi', 'zu', 'ms', 'iw', 'lo', 'tl', 'kk', 'ta', 'te', 'bn', 'ga', 'ht', 'la', 'pa', 'sa']; let langcodes = ['af', 'sq', 'ar', 'eu', 'bg', 'be', 'ca', 'zh', 'zh-tw', 'zh-cn', 'zh-hk', 'zh-sg', 'hr', 'cs', 'da', 'nl', 'nl-be', 'en', 'en-us', 'en-eg', 'en-au', 'en-gb', 'en-ca', 'en-nz', 'en-ie', 'en-za', 'en-jm', 'en-bz', 'en-tt', 'en-001', 'et', 'fo', 'fa', 'fi', 'fr', 'fr-ca', 'gd', 'de', 'de-ch', 'el', 'he', 'hi', 'hu', 'is', 'id', 'it', 'ja', 'ko', 'lv', 'lt', 'mk', 'mt', 'no', 'nb', 'nn', 'pl', 'pt-br', 'pt', 'rm', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'es-mx', 'es-419', 'sv', 'th', 'ts', 'tn', 'tr', 'uk', 'ur', 've', 'vi', 'xh', 'yi', 'zu', 'ms', 'iw', 'lo', 'tl', 'kk', 'ta', 'te', 'bn', 'ga', 'ht', 'la', 'pa', 'sa'];
let sellang = "en" let sellang = "en"
@ -3831,8 +3886,12 @@ const app = new Vue({
this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex); this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex);
}, },
mediaKeyFixes() { mediaKeyFixes() {
navigator.mediaSession.setActionHandler('previoustrack', function () { app.prevButton() }); navigator.mediaSession.setActionHandler('previoustrack', function () {
navigator.mediaSession.setActionHandler('nexttrack', function () { app.skipToNextItem() }); app.prevButton()
});
navigator.mediaSession.setActionHandler('nexttrack', function () {
app.skipToNextItem()
});
}, },
checkForUpdate() { checkForUpdate() {
ipcRenderer.send('check-for-update') ipcRenderer.send('check-for-update')
@ -3843,7 +3902,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 {
@ -4130,14 +4189,14 @@ document.addEventListener('keydown', function (event) {
}); });
window.addEventListener("mouseup", (e) => { window.addEventListener("mouseup", (e) => {
if(e.button === 3) { if (e.button === 3) {
e.preventDefault() e.preventDefault()
app.navigateBack() app.navigateBack()
}else if(e.button === 4){ } else if (e.button === 4) {
e.preventDefault() e.preventDefault()
app.navigateForward() app.navigateForward()
} }
}); });
document.addEventListener('keydown', function (event) { document.addEventListener('keydown', function (event) {
if (event.ctrlKey && event.keyCode == 122) { if (event.ctrlKey && event.keyCode == 122) {

View file

@ -307,7 +307,7 @@
text-align: left; text-align: left;
display: flex; display: flex;
width: 100%; width: 100%;
padding: 12px 16px; padding: 10px 16px;
appearance: none; appearance: none;
border: 0px; border: 0px;
font: inherit; font: inherit;

View file

@ -2741,12 +2741,12 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
.wpfade_transform-enter { .wpfade_transform-enter {
opacity: 0; opacity: 0;
transform: translateX(50%); transform: translateX(50%) translate3d(0,0,0);
will-change: opacity, transform; will-change: opacity, transform;
} }
.wpfade_transform-leave-to { .wpfade_transform-leave-to {
opacity: 0; opacity: 0;
transform: translateX(-50%); transform: translateX(-50%) translate3d(0,0,0);
will-change: opacity, transform; will-change: opacity, transform;
} }
@ -2759,12 +2759,12 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
.wpfade_transform_backwards-enter { .wpfade_transform_backwards-enter {
opacity: 0; opacity: 0;
transform: translateX(-50%); transform: translateX(-50%) translate3d(0,0,0);
will-change: opacity, transform; will-change: opacity, transform;
} }
.wpfade_transform_backwards-leave-to { .wpfade_transform_backwards-leave-to {
opacity: 0; opacity: 0;
transform: translateX(50%); transform: translateX(50%) translate3d(0,0,0);
will-change: opacity, transform; will-change: opacity, transform;
} }

View file

@ -12,7 +12,7 @@
@keyframes menuIn { @keyframes menuIn {
0% { 0% {
opacity : 0; opacity : 0;
transform : translateY(-10px); transform : translateY(-10px) translate3d(0,0,0);
background: @panelColorsFallback; background: @panelColorsFallback;
} }
@ -47,7 +47,7 @@
&:hover { &:hover {
.artwork-container { .artwork-container {
transform : scale(1.1) ; transform : scale(1.1) translate3d(0,0,0);
transition : transform .1s var(--appleEase); transition : transform .1s var(--appleEase);
transition-delay: 0s; transition-delay: 0s;
transform-origin: center; transform-origin: center;
@ -58,7 +58,7 @@
z-index : 1; z-index : 1;
transition : transform .1s var(--appleEase); transition : transform .1s var(--appleEase);
transition-delay: 0s; transition-delay: 0s;
transform : translateY(8px); transform : translateY(8px) translate3d(0,0,0);
} }
} }

View file

@ -91,7 +91,8 @@
years: [], years: [],
loaded: { loaded: {
id: -1 id: -1
} },
musicTypeGenre: ""
} }
}, },
async mounted() { async mounted() {
@ -101,9 +102,12 @@
this.years.reverse() this.years.reverse()
localStorage.setItem("seenReplay", true) localStorage.setItem("seenReplay", true)
this.getReplayYear(); this.getReplayYear();
const musicGenre = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/genres/34`)
this.musicTypeGenre = musicGenre.data.data[0].attributes.name
}, },
methods: { methods: {
songsToArray(songsData) { songsToArray(songsData) {
let self = this
let songs = [] let songs = []
let topGenres = {} let topGenres = {}
let genrePlayCount = 0; let genrePlayCount = 0;
@ -113,7 +117,7 @@
songs.push(song) songs.push(song)
genrePlayCount += song.attributes.playCount genrePlayCount += song.attributes.playCount
song.attributes.genreNames.forEach(function (genre) { song.attributes.genreNames.forEach(function (genre) {
if (genre != "Music") { if (genre != self.musicTypeGenre) {
if (topGenres[genre] == undefined) { if (topGenres[genre] == undefined) {
topGenres[genre] = song.attributes.playCount topGenres[genre] = song.attributes.playCount
} else { } else {