Revert "Merge branch 'local' into develop"

This reverts commit 46ccfa1393, reversing
changes made to 8f9421258c.
This commit is contained in:
vapormusic 2022-02-26 06:21:17 +07:00
parent 46ccfa1393
commit 798a38613d
26 changed files with 158 additions and 205 deletions

View file

@ -169,7 +169,7 @@ export default class LastFMPlugin {
const res = await this._win.webContents.executeJavaScript(` const res = await this._win.webContents.executeJavaScript(`
(async () => { (async () => {
const subMk = await MusicKit.getInstance().api.music("/v1/catalog/" + MusicKit.getInstance().storefrontId + "/songs/${songId}", { const subMk = await MusicKit.getInstance().api.v3.music("/v1/catalog/" + MusicKit.getInstance().storefrontId + "/songs/${songId}", {
include: { include: {
songs: ["artists"] songs: ["artists"]
} }

View file

@ -58,7 +58,7 @@ const MusicKitInterop = {
const id = nowPlayingItem?._songId ?? (nowPlayingItem?.songId ?? nowPlayingItem?.id) const id = nowPlayingItem?._songId ?? (nowPlayingItem?.songId ?? nowPlayingItem?.id)
if (id != null && id != -1) { if (id != null && id != -1) {
try{ try{
const query = await mk.api.music(`/v1${(((nowPlayingItem?._songId ?? nowPlayingItem?.songId) != null) && ((nowPlayingItem?._songId ?? nowPlayingItem?.songId) != -1)) ? `/catalog/${mk.storefrontId}/` : `/me/library/`}songs/${id}?l=${app.mklang}`); const query = await mk.api.v3.music(`/v1${(((nowPlayingItem?._songId ?? nowPlayingItem?.songId) != null) && ((nowPlayingItem?._songId ?? nowPlayingItem?.songId) != -1)) ? `/catalog/${mk.storefrontId}/` : `/me/library/`}songs/${id}?l=${app.mklang}`);
if (query?.data?.data[0]){ if (query?.data?.data[0]){
let attrs = query?.data?.data[0]?.attributes; let attrs = query?.data?.data[0]?.attributes;
if (attrs?.name) { nowPlayingItem.attributes.name = attrs?.name ?? ''} if (attrs?.name) { nowPlayingItem.attributes.name = attrs?.name ?? ''}

View file

@ -203,7 +203,7 @@ const app = new Vue({
}, },
v3: { v3: {
requestBody: { requestBody: {
platform: "auto" platform: "web"
} }
}, },
tmpHeight: '', tmpHeight: '',
@ -412,7 +412,7 @@ const app = new Vue({
if (item.includes("ra.")) { if (item.includes("ra.")) {
type = "stations" type = "stations"
} }
let found = await app.mk.api.music(`/v1/catalog/us/${type}/${item}`) let found = await app.mk.api.v3.music(`/v1/catalog/us/${type}/${item}`)
this.socialBadges.mediaItems.push(found.data.data[0]) this.socialBadges.mediaItems.push(found.data.data[0])
} catch (e) { } catch (e) {
@ -462,7 +462,7 @@ const app = new Vue({
}) { }) {
let self = this let self = this
try { try {
app.mk.api.music("/v1/social/badging-map").then(data => { app.mk.api.v3.music("/v1/social/badging-map").then(data => {
self.socialBadges.badgeMap = data.data.results.badgingMap self.socialBadges.badgeMap = data.data.results.badgingMap
cb(data.data.results.badgingMap) cb(data.data.results.badgingMap)
}) })
@ -525,7 +525,7 @@ const app = new Vue({
}) })
} else if ((self.selectedMediaItems[i].kind == "album" || self.selectedMediaItems[i].kind == "albums") && self.selectedMediaItems[i].isLibrary != true) { } else if ((self.selectedMediaItems[i].kind == "album" || self.selectedMediaItems[i].kind == "albums") && self.selectedMediaItems[i].isLibrary != true) {
self.selectedMediaItems[i].kind = "albums" self.selectedMediaItems[i].kind = "albums"
let res = await self.mk.api.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}
}) })
@ -538,7 +538,7 @@ const app = new Vue({
}) })
} else if ((self.selectedMediaItems[i].kind == "library-album" || self.selectedMediaItems[i].kind == "library-albums") || (self.selectedMediaItems[i].kind == "album" && self.selectedMediaItems[i].isLibrary == true)) { } else if ((self.selectedMediaItems[i].kind == "library-album" || self.selectedMediaItems[i].kind == "library-albums") || (self.selectedMediaItems[i].kind == "album" && self.selectedMediaItems[i].isLibrary == true)) {
self.selectedMediaItems[i].kind = "library-albums" self.selectedMediaItems[i].kind = "library-albums"
let res = await self.mk.api.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}
}) })
@ -565,7 +565,7 @@ const app = new Vue({
}) })
} else if ((self.selectedMediaItems[i].kind == "album" || self.selectedMediaItems[i].kind == "albums") && self.selectedMediaItems[i].isLibrary != true) { } else if ((self.selectedMediaItems[i].kind == "album" || self.selectedMediaItems[i].kind == "albums") && self.selectedMediaItems[i].isLibrary != true) {
self.selectedMediaItems[i].kind = "albums" self.selectedMediaItems[i].kind = "albums"
let res = await self.mk.api.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}
}) })
@ -578,7 +578,7 @@ const app = new Vue({
}) })
} else if ((self.selectedMediaItems[i].kind == "library-album" || self.selectedMediaItems[i].kind == "library-albums") || (self.selectedMediaItems[i].kind == "album" && self.selectedMediaItems[i].isLibrary == true)) { } else if ((self.selectedMediaItems[i].kind == "library-album" || self.selectedMediaItems[i].kind == "library-albums") || (self.selectedMediaItems[i].kind == "album" && self.selectedMediaItems[i].isLibrary == true)) {
self.selectedMediaItems[i].kind = "library-albums" self.selectedMediaItems[i].kind = "library-albums"
let res = await self.mk.api.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}
}) })
@ -592,7 +592,7 @@ const app = new Vue({
} }
this.modals.addToPlaylist = false this.modals.addToPlaylist = false
await app.mk.api.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",
@ -616,9 +616,8 @@ const app = new Vue({
this.setLzManual() this.setLzManual()
clearTimeout(this.hangtimer) clearTimeout(this.hangtimer)
this.mk = MusicKit.getInstance() this.mk = MusicKit.getInstance()
let needsReload = (typeof localStorage["music.8r23j2835d.media-user-token"] == "undefined") let needsReload = (typeof localStorage["music.ampwebplay.media-user-token"] == "undefined")
this.mk.authorize().then((token) => { this.mk.authorize().then(() => {
console.log(mytoken,'token')
self.mkIsReady = true self.mkIsReady = true
if (needsReload) { if (needsReload) {
document.location.reload() document.location.reload()
@ -643,7 +642,7 @@ const app = new Vue({
try { try {
// Set profile name // Set profile name
this.chrome.userinfo = (await app.mk.api.music(`/v1/me/social-profile`)).data.data[0] this.chrome.userinfo = (await app.mk.api.v3.music(`/v1/me/social-profile`)).data.data[0]
} catch (err) { } catch (err) {
} }
@ -753,7 +752,7 @@ const app = new Vue({
} }
break; break;
case "history": case "history":
let history = await app.mk.api.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;
@ -832,7 +831,7 @@ const app = new Vue({
} catch (e) { } catch (e) {
} }
if (previewURL == null && ((app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)) != -1)) { if (previewURL == null && ((app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)) != -1)) {
app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/songs/${app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)}`).then((response) => { app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/songs/${app.mk.nowPlayingItem?._songId ?? (app.mk.nowPlayingItem["songId"] ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id)}`).then((response) => {
previewURL = response.data.data[0].attributes.previews[0].url previewURL = response.data.data[0].attributes.previews[0].url
if (previewURL) if (previewURL)
ipcRenderer.send('getPreviewURL', previewURL) ipcRenderer.send('getPreviewURL', previewURL)
@ -1055,7 +1054,7 @@ const app = new Vue({
}, },
async editPlaylistFolder(id, name = app.getLz('term.newPlaylist')) { async editPlaylistFolder(id, name = app.getLz('term.newPlaylist')) {
let self = this let self = this
this.mk.api.music( this.mk.api.v3.music(
`/v1/me/library/playlist-folders/${id}`, {}, { `/v1/me/library/playlist-folders/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "PATCH", method: "PATCH",
@ -1070,7 +1069,7 @@ const app = new Vue({
}, },
async editPlaylist(id, name = app.getLz('term.newPlaylist')) { async editPlaylist(id, name = app.getLz('term.newPlaylist')) {
let self = this let self = this
this.mk.api.music( this.mk.api.v3.music(
`/v1/me/library/playlists/${id}`, {}, { `/v1/me/library/playlists/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "PATCH", method: "PATCH",
@ -1099,7 +1098,7 @@ const app = new Vue({
if (tracks.length > 0) { if (tracks.length > 0) {
request.tracks = tracks request.tracks = tracks
} }
app.mk.api.music(`/v1/me/library/playlists`, {}, { app.mk.api.v3.music(`/v1/me/library/playlists`, {}, {
fetchOptions: { fetchOptions: {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
@ -1131,7 +1130,7 @@ const app = new Vue({
deletePlaylist(id) { deletePlaylist(id) {
let self = this let self = this
if (confirm(app.getLz('term.deletePlaylist'))) { if (confirm(app.getLz('term.deletePlaylist'))) {
app.mk.api.music(`/v1/me/library/playlists/${id}`, {}, { app.mk.api.v3.music(`/v1/me/library/playlists/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "DELETE" method: "DELETE"
} }
@ -1155,20 +1154,20 @@ 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.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")
}, },
async showRecordLabelView(label, title, view) { async showRecordLabelView(label, title, view) {
let response = (await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/record-labels/${label}/view/${view}?l=${this.mklang}`)).data let response = (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/record-labels/${label}/view/${view}?l=${this.mklang}`)).data
await this.showCollection(response, title, "record-labels") await this.showCollection(response, title, "record-labels")
}, },
async showSearchView(term, group, title) { async showSearchView(term, group, title) {
let requestBody = { let requestBody = {
platform: "auto", platform: "web",
groups: group, groups: group,
types: "activities,albums,apple-curators,artists,curators,editorial-items,music-videos,playlists,songs,stations,record-labels", types: "activities,albums,apple-curators,artists,curators,editorial-items,music-movies,music-videos,playlists,songs,stations,tv-episodes,uploaded-videos,record-labels",
limit: 25, limit: 25,
relate: { relate: {
editorialItems: ["contents"] editorialItems: ["contents"]
@ -1193,7 +1192,7 @@ const app = new Vue({
groups: group, groups: group,
l: this.mklang l: this.mklang
} }
let response = await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${term}`, requestBody, { let response = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${term}`, requestBody, {
includeResponseMeta: !0 includeResponseMeta: !0
}) })
@ -1237,7 +1236,7 @@ const app = new Vue({
let self = this let self = this
const params = { const params = {
include: "tracks", include: "tracks",
platform: "auto", platform: "web",
"include[library-playlists]": "catalog,tracks", "include[library-playlists]": "catalog,tracks",
"fields[playlists]": "curatorName,playlistType,name,artwork,url,playParams", "fields[playlists]": "curatorName,playlistType,name,artwork,url,playParams",
"include[library-songs]": "catalog,artists,albums,playParams,name,artwork,url", "include[library-songs]": "catalog,artists,albums,playParams,name,artwork,url",
@ -1248,12 +1247,12 @@ const app = new Vue({
if (!transient) { if (!transient) {
this.playlists.loadingState = 0; this.playlists.loadingState = 0;
} }
app.mk.api.music(`/v1/me/library/playlists/${id}`, params).then(res => { app.mk.api.v3.music(`/v1/me/library/playlists/${id}`, params).then(res => {
self.getPlaylistContinuous(res, transient) self.getPlaylistContinuous(res, transient)
}).catch((e) => { }).catch((e) => {
console.log(e); console.log(e);
try { try {
app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`, params).then(res => { app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`, params).then(res => {
self.getPlaylistContinuous(res, transient) self.getPlaylistContinuous(res, transient)
}) })
} catch (err) { } catch (err) {
@ -1324,7 +1323,7 @@ const app = new Vue({
this.search.hints = [] this.search.hints = []
return return
} }
let hints = await (await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/search/hints?term=${this.search.term}`)).data.results let hints = await (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search/hints?term=${this.search.term}`)).data.results
this.search.hints = hints ? hints.terms : [] this.search.hints = hints ? hints.terms : []
}, },
getSongProgress() { getSongProgress() {
@ -1404,7 +1403,7 @@ const app = new Vue({
if (kind.toString().includes("apple-curator")) { if (kind.toString().includes("apple-curator")) {
kind = "appleCurator" kind = "appleCurator"
app.getTypeFromID("appleCurator", (id), false, { app.getTypeFromID("appleCurator", (id), false, {
platform: "auto", platform: "web",
include: "grouping,playlists", include: "grouping,playlists",
extend: "editorialArtwork", extend: "editorialArtwork",
"art[url]": "f" "art[url]": "f"
@ -1522,7 +1521,7 @@ const app = new Vue({
} }
if (artistId == "") { if (artistId == "") {
let artistQuery = (await app.mk.api.music(`v1/catalog/${app.mk.storefrontId}/search?term=${item.attributes.artistName}`, { let artistQuery = (await app.mk.api.v3.music(`v1/catalog/${app.mk.storefrontId}/search?term=${item.attributes.artistName}`, {
limit: 1, limit: 1,
types: 'artists' types: 'artists'
})).data.results; })).data.results;
@ -1560,7 +1559,7 @@ const app = new Vue({
if (albumId == "") { if (albumId == "") {
try { try {
let albumQuery = (await app.mk.api.music(`v1/catalog/${app.mk.storefrontId}/search?term=${(item.attributes.albumName ?? item.attributes.name ?? "") + " " + (item.attributes.artistName ?? "")}`, { let albumQuery = (await app.mk.api.v3.music(`v1/catalog/${app.mk.storefrontId}/search?term=${(item.attributes.albumName ?? item.attributes.name ?? "") + " " + (item.attributes.artistName ?? "")}`, {
limit: 1, limit: 1,
types: 'albums' types: 'albums'
})).data.results; })).data.results;
@ -1584,7 +1583,7 @@ const app = new Vue({
if (labelId == "") { if (labelId == "") {
try { try {
let labelQuery = (await app.mk.api.music(`v1/catalog/${app.mk.storefrontId}/search?term=${item.attributes.recordLabel}`, { let labelQuery = (await app.mk.api.v3.music(`v1/catalog/${app.mk.storefrontId}/search?term=${item.attributes.recordLabel}`, {
limit: 1, limit: 1,
types: 'record-labels' types: 'record-labels'
})).data.results; })).data.results;
@ -1656,7 +1655,7 @@ const app = new Vue({
// var playlistId = id // var playlistId = id
// const params = { // const params = {
// include: "tracks", // include: "tracks",
// platform: "auto", // 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",
@ -1969,9 +1968,9 @@ const app = new Vue({
let truemethod = (!method.endsWith("s")) ? (method + "s") : method; let truemethod = (!method.endsWith("s")) ? (method + "s") : method;
try { try {
if (library) { if (library) {
return await this.mk.api.music(`v1/me/library/${truemethod}/${term.toString()}`, params, params2) return await this.mk.api.v3.music(`v1/me/library/${truemethod}/${term.toString()}`, params, params2)
} else { } else {
return await this.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/${truemethod}/${term.toString()}`, params, params2) return await this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/${truemethod}/${term.toString()}`, params, params2)
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
@ -2016,23 +2015,23 @@ const app = new Vue({
"include[library-songs]": "catalog,artists,albums", "include[library-songs]": "catalog,artists,albums",
"fields[artists]": "name,url,id", "fields[artists]": "name,url,id",
"fields[albums]": "name,url,id", "fields[albums]": "name,url,id",
platform: "auto", platform: "web",
"fields[catalog]": "artistUrl,albumUrl", "fields[catalog]": "artistUrl,albumUrl",
"fields[songs]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,name,playParams,releaseDate,url", "fields[songs]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,name,playParams,releaseDate,url",
limit: 100, limit: 100,
l: self.mklang l: self.mklang
} }
const safeparams = { const safeparams = {
platform: "auto", "platform": "web",
"limit": 80 "limit": 80
} }
self.library.songs.downloadState = 1 self.library.songs.downloadState = 1
if (downloaded == null) { if (downloaded == null) {
app.mk.api.music(`/v1/me/library/songs/`, params).then((response) => { app.mk.api.v3.music(`/v1/me/library/songs/`, params).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading'); console.log('safe loading');
app.mk.api.music(`/v1/me/library/songs/`, safeparams).then((response) => { app.mk.api.v3.music(`/v1/me/library/songs/`, safeparams).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading failed', error) console.log('safe loading failed', error)
@ -2042,11 +2041,11 @@ const app = new Vue({
}) })
} else { } else {
if (downloaded.next != null) { if (downloaded.next != null) {
app.mk.api.music(downloaded.next, params).then((response) => { app.mk.api.v3.music(downloaded.next, params).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading'); console.log('safe loading');
app.mk.api.music(downloaded.next, safeparams).then((response) => { app.mk.api.v3.music(downloaded.next, safeparams).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading failed', error) console.log('safe loading failed', error)
@ -2120,14 +2119,14 @@ const app = new Vue({
"include[library-albums]": "catalog,artists,albums", "include[library-albums]": "catalog,artists,albums",
"fields[artists]": "name,url,id", "fields[artists]": "name,url,id",
"fields[albums]": "name,url,id", "fields[albums]": "name,url,id",
platform: "auto", platform: "web",
"fields[catalog]": "artistUrl,albumUrl", "fields[catalog]": "artistUrl,albumUrl",
"fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,name,playParams,releaseDate,url", "fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,name,playParams,releaseDate,url",
limit: 100, limit: 100,
l: self.mklang l: self.mklang
} }
const safeparams = { const safeparams = {
platform: "auto", platform: "web",
limit: "60", limit: "60",
"include[library-albums]": "artists", "include[library-albums]": "artists",
"include[library-artists]": "catalog", "include[library-artists]": "catalog",
@ -2137,11 +2136,11 @@ const app = new Vue({
"includeOnly": "catalog,artists" "includeOnly": "catalog,artists"
} }
if (downloaded == null) { if (downloaded == null) {
app.mk.api.music(`/v1/me/library/albums/`, params).then((response) => { app.mk.api.v3.music(`/v1/me/library/albums/`, params).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading'); console.log('safe loading');
app.mk.api.music(`/v1/me/library/albums/`, safeparams).then((response) => { app.mk.api.v3.music(`/v1/me/library/albums/`, safeparams).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading failed', error) console.log('safe loading failed', error)
@ -2151,11 +2150,11 @@ const app = new Vue({
}) })
} else { } else {
if (downloaded.next != null) { if (downloaded.next != null) {
app.mk.api.music(downloaded.next, params).then((response) => { app.mk.api.v3.music(downloaded.next, params).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading'); console.log('safe loading');
app.mk.api.music(downloaded.next, safeparams).then((response) => { app.mk.api.v3.music(downloaded.next, safeparams).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading failed', error); console.log('safe loading failed', error);
@ -2230,7 +2229,7 @@ const app = new Vue({
// "include[library-artists]": "catalog,artists,albums", // "include[library-artists]": "catalog,artists,albums",
// "fields[artists]": "name,url,id", // "fields[artists]": "name,url,id",
// "fields[albums]": "name,url,id", // "fields[albums]": "name,url,id",
platform: "auto", platform: "web",
// "fields[catalog]": "artistUrl,albumUrl", // "fields[catalog]": "artistUrl,albumUrl",
// "fields[artists]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,name,playParams,releaseDate,url", // "fields[artists]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,name,playParams,releaseDate,url",
limit: 100, limit: 100,
@ -2238,15 +2237,15 @@ const app = new Vue({
} }
const safeparams = { const safeparams = {
include: "catalog", include: "catalog",
platform: "auto", platform: "web",
limit: 50, limit: 50,
} }
if (downloaded == null) { if (downloaded == null) {
app.mk.api.music(`/v1/me/library/artists/`, params).then((response) => { app.mk.api.v3.music(`/v1/me/library/artists/`, params).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading'); console.log('safe loading');
app.mk.api.music(`/v1/me/library/artists/`, safeparams).then((response) => { app.mk.api.v3.music(`/v1/me/library/artists/`, safeparams).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading failed', error) console.log('safe loading failed', error)
@ -2257,11 +2256,11 @@ const app = new Vue({
} else { } else {
if (downloaded.next != null) { if (downloaded.next != null) {
app.mk.api.music(downloaded.next, params).then((response) => { app.mk.api.v3.music(downloaded.next, params).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading'); console.log('safe loading');
app.mk.api.music(downloaded.next, safeparams).then((response) => { app.mk.api.v3.music(downloaded.next, safeparams).then((response) => {
processChunk(response.data) processChunk(response.data)
}).catch((error) => { }).catch((error) => {
console.log('safe loading failed', error) console.log('safe loading failed', error)
@ -2346,9 +2345,9 @@ const app = new Vue({
return return
} }
try { try {
this.listennow = (await this.mk.api.music(`v1/me/recommendations?timezone=${encodeURIComponent(this.formatTimezoneOffset())}`, { this.listennow = (await this.mk.api.v3.music(`v1/me/recommendations?timezone=${encodeURIComponent(this.formatTimezoneOffset())}`, {
name: "listen-now", name: "listen-now",
with: "friendsMix,library", with: "friendsMix,library,social",
"art[social-profiles:url]": "c", "art[social-profiles:url]": "c",
"art[url]": "c,f", "art[url]": "c,f",
"omit[resource]": "autos", "omit[resource]": "autos",
@ -2366,8 +2365,8 @@ const app = new Vue({
"fields[artists]": ["name", "url"], "fields[artists]": ["name", "url"],
"extend[stations]": ["airDate", "supportsAirTimeUpdates"], "extend[stations]": ["airDate", "supportsAirTimeUpdates"],
"meta[stations]": "inflectionPoints", "meta[stations]": "inflectionPoints",
types: "artists,albums,editorial-items,library-albums,library-playlists,music-videos,playlists,stations,activities,apple-curators,curators", types: "artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-upsells",
platform: "auto", platform: "web",
l: this.mklang l: this.mklang
}, { }, {
includeResponseMeta: !0, includeResponseMeta: !0,
@ -2388,9 +2387,9 @@ const app = new Vue({
return return
} }
try { try {
let browse = await app.mk.api.music(`/v1/editorial/${app.mk.storefrontId}/groupings`, { let browse = await app.mk.api.v3.music(`/v1/editorial/${app.mk.storefrontId}/groupings`, {
platform: "auto", platform: "web",
// name: "music", name: "music",
"omit[resource:artists]": "relationships", "omit[resource:artists]": "relationships",
"include[albums]": "artists", "include[albums]": "artists",
"include[songs]": "artists", "include[songs]": "artists",
@ -2413,8 +2412,8 @@ const app = new Vue({
return return
} }
try { try {
this.radio.personal = (await app.mk.api.music(`/v1/me/recent/radio-stations`, { this.radio.personal = (await app.mk.api.v3.music(`/v1/me/recent/radio-stations`, {
platform: "auto", "platform": "web",
"art[url]": "f", "art[url]": "f",
l: this.mklang l: this.mklang
})).data.data; })).data.data;
@ -2428,7 +2427,7 @@ const app = new Vue({
return return
} }
try { try {
mfu = await app.mk.api.music("/v1/me/library/playlists?platform=auto&extend=editorialVideo&fields%5Bplaylists%5D=lastModifiedDate&filter%5Bfeatured%5D=made-for-you&include%5Blibrary-playlists%5D=catalog&fields%5Blibrary-playlists%5D=artwork%2Cname%2CplayParams%2CdateAdded") mfu = await app.mk.api.v3.music("/v1/me/library/playlists?platform=web&extend=editorialVideo&fields%5Bplaylists%5D=lastModifiedDate&filter%5Bfeatured%5D=made-for-you&include%5Blibrary-playlists%5D=catalog&fields%5Blibrary-playlists%5D=artwork%2Cname%2CplayParams%2CdateAdded")
this.madeforyou = mfu.data this.madeforyou = mfu.data
} catch (e) { } catch (e) {
console.log(e) console.log(e)
@ -2437,7 +2436,7 @@ const app = new Vue({
}, },
newPlaylistFolder(name = app.getLz('term.newPlaylistFolder')) { newPlaylistFolder(name = app.getLz('term.newPlaylistFolder')) {
let self = this let self = this
this.mk.api.music( this.mk.api.v3.music(
"/v1/me/library/playlist-folders/", {}, { "/v1/me/library/playlist-folders/", {}, {
fetchOptions: { fetchOptions: {
method: "POST", method: "POST",
@ -2482,7 +2481,7 @@ const app = new Vue({
const songID = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem["_songId"] ?? (this.mk.nowPlayingItem["songId"] ?? -1) : -1; const songID = (this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem["_songId"] ?? (this.mk.nowPlayingItem["songId"] ?? -1) : -1;
// this.getMXM( trackName, artistName, 'en', duration); // this.getMXM( trackName, artistName, 'en', duration);
if (songID != -1) { if (songID != -1) {
this.mk.api.music(`v1/catalog/${this.mk.storefrontId}/songs/${songID}/lyrics`) this.mk.api.v3.music(`v1/catalog/${this.mk.storefrontId}/songs/${songID}/lyrics`)
.then((response) => { .then((response) => {
this.lyricsMediaItem = response.data?.data[0]?.attributes["ttml"] this.lyricsMediaItem = response.data?.data[0]?.attributes["ttml"]
this.parseTTML() this.parseTTML()
@ -2499,7 +2498,7 @@ const app = new Vue({
removeFromLibrary(kind, id) { removeFromLibrary(kind, id) {
let self = this let self = this
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
app.mk.api.music(`v1/me/library/${truekind}/${id.toString()}`, {}, { app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`, {}, {
fetchOptions: { fetchOptions: {
method: "DELETE" method: "DELETE"
} }
@ -3160,9 +3159,9 @@ const app = new Vue({
if (term == "") { if (term == "") {
return return
} }
//this.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${this.search.term}` //this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${this.search.term}`
this.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${encodeURIComponent(this.search.term)}`, { this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${encodeURIComponent(this.search.term)}`, {
types: "activities,albums,apple-curators,artists,curators,editorial-items,music-videos,playlists,songs,stations,record-labels", types: "activities,albums,apple-curators,artists,curators,editorial-items,music-movies,music-videos,playlists,songs,stations,tv-episodes,uploaded-videos,record-labels",
"relate[editorial-items]": "contents", "relate[editorial-items]": "contents",
"include[editorial-items]": "contents", "include[editorial-items]": "contents",
"include[albums]": "artists", "include[albums]": "artists",
@ -3170,13 +3169,12 @@ const app = new Vue({
"include[songs]": "artists,albums", "include[songs]": "artists,albums",
"include[music-videos]": "artists", "include[music-videos]": "artists",
"extend": "artistUrl", "extend": "artistUrl",
"fields[artists]": "url,name,hero", "fields[artists]": "url,name,artwork,hero",
"fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url", "fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url",
"with": "serverBubbles,lyricHighlights", "with": "serverBubbles,lyricHighlights",
"art[url]": "c,f", "art[url]": "c,f",
"omit[resource]": "autos", "omit[resource]": "autos",
platform: "auto", "platform": "web",
limit: 25, limit: 25,
l: this.mklang l: this.mklang
}).then(function (results) { }).then(function (results) {
@ -3184,16 +3182,16 @@ const app = new Vue({
self.search.results = results.data.results self.search.results = results.data.results
}) })
// await app.mk.api.music(`v1/social/${app.mk.storefrontId}/search?term=${app.search.term}`, { await app.mk.api.v3.music(`v1/social/${app.mk.storefrontId}/search?term=${app.search.term}`, {
// types: ["playlists", "social-profiles"], types: ["playlists", "social-profiles"],
// limit: 25, limit: 25,
// 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
// }) })
}, },
async inLibrary(items = []) { async inLibrary(items = []) {
let types = [] let types = []
@ -3225,7 +3223,7 @@ const app = new Vue({
result[key] = item[key]; result[key] = item[key];
return result; return result;
}, {}); }, {});
return (await this.mk.api.music(`/v1/catalog/${app.mk.storefrontId}`, { return (await this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}`, {
...{ ...{
"omit[resource]": "autos", "omit[resource]": "autos",
relate: "library", relate: "library",
@ -3339,7 +3337,7 @@ const app = new Vue({
} catch (e) { } catch (e) {
} }
} else { } else {
let data = await this.mk.api.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}', 50).replace('{h}', 50);
@ -3363,7 +3361,7 @@ const app = new Vue({
async setLibraryArt() { async setLibraryArt() {
if (typeof this.mk.nowPlayingItem === "undefined") return; if (typeof this.mk.nowPlayingItem === "undefined") return;
try { try {
const data = await this.mk.api.music(`/v1/me/library/songs/${this.mk.nowPlayingItem.id}`); const 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 !== "") { if (data != null && data !== "") {
@ -3377,7 +3375,7 @@ const app = new Vue({
async setLibraryArtBG() { async setLibraryArtBG() {
if (typeof this.mk.nowPlayingItem === "undefined") return; if (typeof this.mk.nowPlayingItem === "undefined") return;
try { try {
const data = await this.mk.api.music(`/v1/me/library/songs/${this.mk.nowPlayingItem.id}`); const 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 !== "") { if (data != null && data !== "") {
@ -3415,7 +3413,7 @@ const app = new Vue({
} }
id = item.id id = item.id
} }
let response = await this.mk.api.music(`/v1/me/ratings/${type}?platform=auto&ids=${type.includes('library') ? item.id : id}`) let response = await this.mk.api.v3.music(`/v1/me/ratings/${type}?platform=web&ids=${type.includes('library') ? item.id : id}`)
if (response.data.data.length != 0) { if (response.data.data.length != 0) {
let value = response.data.data[0].attributes.value let value = response.data.data[0].attributes.value
return value return value
@ -3432,7 +3430,7 @@ const app = new Vue({
} }
id = item.id id = item.id
} }
this.mk.api.music(`/v1/me/ratings/${type}/${id}`, {}, { this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "PUT", method: "PUT",
body: JSON.stringify({ body: JSON.stringify({
@ -3453,7 +3451,7 @@ const app = new Vue({
} }
id = item.id id = item.id
} }
this.mk.api.music(`/v1/me/ratings/${type}/${id}`, {}, { this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "PUT", method: "PUT",
body: JSON.stringify({ body: JSON.stringify({
@ -3474,7 +3472,7 @@ const app = new Vue({
} }
id = item.id id = item.id
} }
this.mk.api.music(`/v1/me/ratings/${type}/${id}`, {}, { this.mk.api.v3.music(`/v1/me/ratings/${type}/${id}`, {}, {
fetchOptions: { fetchOptions: {
method: "DELETE", method: "DELETE",
} }
@ -3549,7 +3547,7 @@ const app = new Vue({
fetchPlaylist(id, callback) { fetchPlaylist(id, callback) {
// id can be found in playlist.attributes.playParams.globalId // id can be found in playlist.attributes.playParams.globalId
// this.mk.api. // this.mk.api.
this.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`).then(res => { this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`).then(res => {
callback(res.data.data[0]) callback(res.data.data[0])
}) })
@ -3898,7 +3896,7 @@ const app = new Vue({
let u = this.cfg.general.language; let u = this.cfg.general.language;
// use MusicKit.getInstance or crash // use MusicKit.getInstance or crash
try { try {
let item = await MusicKit.getInstance().api.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) { if (langcodes) langcodes = langcodes.map(function (u) {
return u.replace(/-Han[s|t]/i, "").toLowerCase() return u.replace(/-Han[s|t]/i, "").toLowerCase()
@ -3953,21 +3951,6 @@ const app = new Vue({
checkForUpdate() { checkForUpdate() {
ipcRenderer.send('check-for-update') ipcRenderer.send('check-for-update')
}, },
async loadArtistImage(id){
try {
let u = await fetch(`https://music.apple.com/${app.mk.storefrontId}/artist/${id}`);
let html = await u.text();
function getStringBetween(str, start, end) {
const result = str.match(new RegExp(start + "(.*)" + end));
return result[1];
}
let string = getStringBetween(html, '<meta property="og:image:secure_url" content="', "cw.png").replace(`1200x630`, `300x300.png`);
return await string;
} catch (err) {
return await ''
}
}
} }
}) })
@ -4068,7 +4051,7 @@ function fallbackinitMusicKit() {
function loadAlternateKey() { function loadAlternateKey() {
let parsedJson = JSON.parse(this.responseText) let parsedJson = JSON.parse(this.responseText)
MusicKit.configure({ MusicKit.configure({
developerToken: 'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlhXM0w4WVQzUzQifQ.eyJpYXQiOjE2NDU3Njg0MzUsImV4cCI6MTY2MTMyMDQzNSwiaXNzIjoiOFIyM0oyODM1RCJ9.h54gKwfUTR4AOsf_n00a5DKvTfTqbcZJGrxCOvJWFMHhKll-jTb-NqNzMX4Zi0EsCPfFcEueShdsTRE1rJzHzw', developerToken: parsedJson.developerToken,
app: { app: {
name: 'Apple Music', name: 'Apple Music',
build: '1978.4.1', build: '1978.4.1',
@ -4092,7 +4075,7 @@ document.addEventListener('musickitloaded', function () {
function initMusicKit() { function initMusicKit() {
let parsedJson = JSON.parse(this.responseText) let parsedJson = JSON.parse(this.responseText)
MusicKit.configure({ MusicKit.configure({
developerToken: 'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlhXM0w4WVQzUzQifQ.eyJpYXQiOjE2NDU3Njg0MzUsImV4cCI6MTY2MTMyMDQzNSwiaXNzIjoiOFIyM0oyODM1RCJ9.h54gKwfUTR4AOsf_n00a5DKvTfTqbcZJGrxCOvJWFMHhKll-jTb-NqNzMX4Zi0EsCPfFcEueShdsTRE1rJzHzw', developerToken: parsedJson.token,
app: { app: {
name: 'Apple Music', name: 'Apple Music',
build: '1978.4.1', build: '1978.4.1',

View file

@ -13,7 +13,7 @@
// &fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url // &fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url
// &fields[artists]=name,url&extend[stations]=airDate,supportsAirTimeUpdates&meta[stations]=inflectionPoints // &fields[artists]=name,url&extend[stations]=airDate,supportsAirTimeUpdates&meta[stations]=inflectionPoints
// &types=artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells // &types=artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells
// &l=en-gb&platform=auto // &l=en-gb&platform=web
await app.mk.api.personalRecommendations("", await app.mk.api.personalRecommendations("",
{ {
@ -48,7 +48,7 @@ await app.mk.api.personalRecommendations("",
// Browse page // Browse page
await app.mk.api.groupings("", await app.mk.api.groupings("",
{ {
platform: "auto", platform: "web",
name: "music", name: "music",
l: "en-gb", l: "en-gb",
"omit[resource:artists]": "relationships", "omit[resource:artists]": "relationships",
@ -63,12 +63,12 @@ await app.mk.api.groupings("",
// Radio page // Radio page
await app.mk.api.recentRadioStations("", await app.mk.api.recentRadioStations("",
{l: "en-gb", {l: "en-gb",
platform: "auto", "platform": "web",
"art[url]": "f"}); "art[url]": "f"});
// Recently Added // Recently Added
await app.mk.api.library.recentlyAdded({ await app.mk.api.library.recentlyAdded({
platform: "auto", "platform": "web",
include: { include: {
"library-albums": ["artists"], "library-albums": ["artists"],
"library-artists": ["catalog"] "library-artists": ["catalog"]

View file

@ -1,7 +1,7 @@
<script type="text/x-template" id="artist-chip"> <script type="text/x-template" id="artist-chip">
<div class="artist-chip" @click.self="route"> <div class="artist-chip" @click.self="route">
<div class="artist-chip__image"> <div class="artist-chip__image">
<mediaitem-artwork v-if="artist.id != null" :url="artistimage" :size="32"></mediaitem-artwork> <mediaitem-artwork v-if="artist.id != null" :url="artist.attributes.artwork.url" :size="32"></mediaitem-artwork>
</div> </div>
<div class="artist-chip__name"> <div class="artist-chip__name">
<span>{{ item.attributes.name }}</span> <span>{{ item.attributes.name }}</span>
@ -16,30 +16,24 @@
props: { props: {
item: { item: {
type: Object, type: Object,
required: true, required: true
} }
}, },
data: function() { data: function() {
return { return {
artist: { artist: {
id: null id: null
}, }
artistimage : ''
} }
}, },
template: '#artist-chip', template: '#artist-chip',
async mounted() { async mounted() {
let artistId = this.item.id let artistId = this.item.id
if(typeof this.item.relationships.catalog == "object") { if(typeof this.item.relationships.catalog == "object") {
artistId = this.item.relationships.catalog.data[0].id artistId = this.item.relationships.catalog.data[0].id
} }
app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(async (response) => { app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(response => {
this.artist = response.data.data[0]; this.artist = response.data.data[0];
if (this.artistimage == '' && artistId != null){
this.artistimage = (await this.$root.loadArtistImage(artistId) ?? '').replace('300x300','50x50')
}
}); });
}, },
methods: { methods: {

View file

@ -58,8 +58,8 @@
}, },
async select(e) { async select(e) {
let u = this.item let u = this.item
let u1 = await app.mk.api.music(`/v1/me/library/artists/${u.id}/albums`, { let u1 = await app.mk.api.v3.music(`/v1/me/library/artists/${u.id}/albums`, {
platform: "auto", "platform": "web",
"include[library-albums]": "artists,tracks", "include[library-albums]": "artists,tracks",
"include[library-artists]": "catalog", "include[library-artists]": "catalog",
"fields[artists]": "url", "fields[artists]": "url",

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="listennow-child"> <script type="text/x-template" id="listennow-child">
<div v-observe-visibility="{callback: visibilityChanged}"> <div v-observe-visibility="{callback: visibilityChanged}">
<template v-if="isVisible && recom.attributes.display?.kind != 'MusicSuperHeroShelf'"> <template v-if="isVisible && recom.attributes.display.kind != 'MusicSuperHeroShelf'">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h3>{{ recom.attributes.title ? recom.attributes.title.stringForDisplay : ""}}</h3> <h3>{{ recom.attributes.title ? recom.attributes.title.stringForDisplay : ""}}</h3>
@ -9,7 +9,7 @@
<button class="cd-btn-seeall" @click="app.showCollection(recom.relationships.contents, recom.attributes.title ? recom.attributes.title.stringForDisplay : '', 'listen_now')" >{{app.getLz('term.seeAll')}}</button> <button class="cd-btn-seeall" @click="app.showCollection(recom.relationships.contents, recom.attributes.title ? recom.attributes.title.stringForDisplay : '', 'listen_now')" >{{app.getLz('term.seeAll')}}</button>
</div> </div>
</div> </div>
<template v-if="!recom.id.startsWith('6-') && index != 0"> <template v-if="recom.attributes.display.kind == 'MusicCoverShelf'">
<mediaitem-scroller-horizontal-large <mediaitem-scroller-horizontal-large
:items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-large> :items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-large>
</template> </template>
@ -18,7 +18,7 @@
:items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-sp> :items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-sp>
</template> </template>
</template> </template>
<template v-else-if="recom.attributes.display?.kind != 'MusicSuperHeroShelf'"> <template v-else-if="recom.attributes.display.kind != 'MusicSuperHeroShelf'">
<div style="height:330px"> </div> <div style="height:330px"> </div>
</template> </template>
@ -27,11 +27,11 @@
<script> <script>
Vue.component('listennow-child', { Vue.component('listennow-child', {
template: "#listennow-child", template: "#listennow-child",
props: ["recom", "index"], props: ["recom"],
data: function () { data: function () {
return { return {
isVisible: true, isVisible: true,
app: this.$root, app: this.$root
} }
}, },
methods: { methods: {

View file

@ -539,8 +539,8 @@
var playlistId = id var playlistId = id
function getPlaylist(id, isLibrary) { function getPlaylist(id, isLibrary) {
if (isLibrary) { if (isLibrary) {
return this.app.mk.api.music(`/v1/me/library/playlists/${id}`) return this.app.mk.api.v3.music(`/v1/me/library/playlists/${id}`)
} else { return this.app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`) } } else { return this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`) }
} }
try { try {
getPlaylist(id, isLibrary).then(res => { getPlaylist(id, isLibrary).then(res => {

View file

@ -10,7 +10,7 @@
</div> </div>
<div class="artwork" @click='app.routeView(item)'> <div class="artwork" @click='app.routeView(item)'>
<mediaitem-artwork <mediaitem-artwork
:url="mainimageurl" :url="getArtworkUrl()"
:video="(item.attributes != null && item.attributes.editorialVideo != null) ? (item.attributes.editorialVideo.motionDetailSquare ? item.attributes.editorialVideo.motionDetailSquare.video : (item.attributes.editorialVideo.motionSquareVideo1x1 ? item.attributes.editorialVideo.motionSquareVideo1x1.video : '')) : '' " :video="(item.attributes != null && item.attributes.editorialVideo != null) ? (item.attributes.editorialVideo.motionDetailSquare ? item.attributes.editorialVideo.motionDetailSquare.video : (item.attributes.editorialVideo.motionSquareVideo1x1 ? item.attributes.editorialVideo.motionSquareVideo1x1.video : '')) : '' "
:size="size" :size="size"
shadow="subtle" shadow="subtle"
@ -77,8 +77,7 @@
app: this.$root, app: this.$root,
badges: this.$root.socialBadges.badgeMap, badges: this.$root.socialBadges.badgeMap,
itemBadges: [], itemBadges: [],
unavailable: false, unavailable: false
mainimageurl: '',
} }
}, },
async mounted() { async mounted() {
@ -92,7 +91,6 @@
this.unavailable = true this.unavailable = true
} }
} }
this.getMainImage()
}, },
methods: { methods: {
getBgColor() { getBgColor() {
@ -152,7 +150,7 @@
let friends = this.badges[id] let friends = this.badges[id]
if (friends) { if (friends) {
friends.forEach(function (friend) { friends.forEach(function (friend) {
self.app.mk.api.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => { self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
self.itemBadges.push(data.data.data[0]) self.itemBadges.push(data.data.data[0])
}) })
}) })
@ -172,7 +170,7 @@
let kind = this.item.type ?? this.item.attributes.playParams.kind let kind = this.item.type ?? this.item.attributes.playParams.kind
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
if (truekind == "musicVideos") {truekind = "music-videos"} if (truekind == "musicVideos") {truekind = "music-videos"}
let res = await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params); let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
res = res.data.data[0] res = res.data.data[0]
this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
} else { } else {
@ -188,13 +186,13 @@
let kind = this.item.type ?? this.item.attributes.playParams.kind let kind = this.item.type ?? this.item.attributes.playParams.kind
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
if (truekind == "musicVideos") {truekind = "music-videos"} if (truekind == "musicVideos") {truekind = "music-videos"}
let res = await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params); let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
res= res.data.data[0] res= res.data.data[0]
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) { if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
id = res.relationships.library.data[0].id id = res.relationships.library.data[0].id
} }
app.mk.api.music(`v1/me/library/${truekind}/${id.toString()}`,{}, app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
{ {
fetchOptions: { fetchOptions: {
method: "DELETE" method: "DELETE"
@ -207,10 +205,7 @@
); );
}, },
getArtworkUrl(size = -1, includeUrl = false) { getArtworkUrl(size = -1, includeUrl = false) {
let artwork = this.item.attributes?.artwork ? this.item.attributes.artwork?.url : '' let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : ''
// if (artwork == '' && this.item.type == "artists" && this.item.id != null) {
// artwork = (await app.loadArtistImage(this.item.id)).toString();
// }
if(size != -1) { if(size != -1) {
artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc")) artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc"))
} }
@ -225,12 +220,6 @@
return `url("${artwork}")` return `url("${artwork}")`
} }
}, },
async getMainImage(){
this.mainimageurl = this.getArtworkUrl()
if (this.mainimageurl == '' && this.item.id != null && this.item.type == "artists") {
this.mainimageurl = await this.app.loadArtistImage(this.item.id)
}
},
getClasses() { getClasses() {
let type = this.item.type let type = this.item.type
if (this.kind != "") { if (this.kind != "") {

View file

@ -66,7 +66,7 @@
}, },
methods: { methods: {
async getHistory() { async getHistory() {
let history = await app.mk.api.music(`/v1/me/recent/played/tracks`, { l : this.$root.mklang}) let history = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, { l : this.$root.mklang})
this.history = history.data.data this.history = history.data.data
}, },
select(e, position) { select(e, position) {

View file

@ -88,7 +88,7 @@
console.log(sendTo) console.log(sendTo)
let type = item.type.replace("library-", "") let type = item.type.replace("library-", "")
let typeTo = sendTo.type let typeTo = sendTo.type
this.$root.mk.api.music(`/v1/me/library/${type}/${item.id}/parent`, {}, { this.$root.mk.api.v3.music(`/v1/me/library/${type}/${item.id}/parent`, {}, {
fetchOptions: { fetchOptions: {
method: "PUT", method: "PUT",
body: JSON.stringify({ body: JSON.stringify({
@ -197,7 +197,7 @@
this.getChildren() this.getChildren()
this.toggleFolder() this.toggleFolder()
this.$root.mk.api.music(`v1/me/library/playlist-folders/${item.id}/children`).then(data => { this.$root.mk.api.v3.music(`v1/me/library/playlist-folders/${item.id}/children`).then(data => {
let children = data.data.data; let children = data.data.data;
children.forEach(child => { children.forEach(child => {
if(!self.$root.playlists.listing.find(listing => listing.id == child.id)) { if(!self.$root.playlists.listing.find(listing => listing.id == child.id)) {

View file

@ -83,7 +83,7 @@
src="musickit.js?v=1"></script> src="musickit.js?v=1"></script>
<script> <script>
if (typeof MusicKit == 'undefined') { if (typeof MusicKit == 'undefined') {
document.write(unescape("%3Cscript src='https://js-cdn.music.apple.com/musickit/v2/musickit.js' type='text/javascript'%3E%3C/script%3E")); document.write(unescape("%3Cscript src='https://js-cdn.music.apple.com/musickit/v2/amp/musickit.js' type='text/javascript'%3E%3C/script%3E"));
} }
</script> </script>
<script src="./js/fast-plural-rules.js"></script> <script src="./js/fast-plural-rules.js"></script>

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-applecurator"> <script type="text/x-template" id="cider-applecurator">
<div class="content-inner"> <div class="content-inner">
<h1 class="header-text">{{ data.attributes?.shortName ?? data.attributes?.name}}</h1> <h1 class="header-text">{{ data.attributes.shortName ?? data.attributes.name}}</h1>
<template v-if="data.relationships && data.relationships.grouping"> <template v-if="data.relationships && data.relationships.grouping">
<template v-for="(recom,index) in data.relationships.grouping.data[0].relationships.tabs.data[0].relationships.children.data"> <template v-for="(recom,index) in data.relationships.grouping.data[0].relationships.tabs.data[0].relationships.children.data">
<div class="row"> <div class="row">
@ -26,10 +26,6 @@
</template> </template>
</template> </template>
</template> </template>
<template v-if="data.relationships && data.relationships.playlists">
<mediaitem-square :size="'300'" :item="playlist" v-for="(playlist,index) in data.relationships.playlists.data">
</mediaitem-square>
</template>
</div> </div>
</script> </script>

View file

@ -87,7 +87,7 @@
} }
try { try {
const chunkArtistData = await Promise.all(chunks.map(chunk => const chunkArtistData = await Promise.all(chunks.map(chunk =>
this.app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${chunk.toString()}&views=latest-release&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=2&art[url]=f`))) this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${chunk.toString()}&views=latest-release&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=2&art[url]=f`)))
chunkArtistData.forEach(chunkResult => chunkArtistData.forEach(chunkResult =>
chunkResult.data.data.forEach(item => { chunkResult.data.data.forEach(item => {
self.artists.push(item) self.artists.push(item)

View file

@ -12,7 +12,7 @@
<div class="artist-image" v-if="!(data.attributes.editorialVideo && (data.attributes.editorialVideo.motionArtistWide16x9 || data.attributes.editorialVideo.motionArtistFullscreen16x9))"> <div class="artist-image" v-if="!(data.attributes.editorialVideo && (data.attributes.editorialVideo.motionArtistWide16x9 || data.attributes.editorialVideo.motionArtistFullscreen16x9))">
<mediaitem-artwork <mediaitem-artwork
shadow="large" shadow="large"
:url="artistimage" :url="data.attributes.artwork ? data.attributes.artwork.url : ''"
size="190" type="artists"></mediaitem-artwork> size="190" type="artists"></mediaitem-artwork>
<button class="overlay-play" @click="app.mk.setStationQueue({artist:'a-'+data.id}).then(()=>{ <button class="overlay-play" @click="app.mk.setStationQueue({artist:'a-'+data.id}).then(()=>{
app.mk.play() app.mk.play()
@ -35,7 +35,7 @@
</button> </button>
</div> </div>
<div class="artworkContainer" v-if="!(data.attributes.editorialVideo && (data.attributes.editorialVideo.motionArtistWide16x9 || data.attributes.editorialVideo.motionArtistFullscreen16x9))"> <div class="artworkContainer" v-if="!(data.attributes.editorialVideo && (data.attributes.editorialVideo.motionArtistWide16x9 || data.attributes.editorialVideo.motionArtistFullscreen16x9))">
<artwork-material :url="data.attributes.artwork?.url ?? ''" size="190" images="1"></artwork-material> <artwork-material :url="data.attributes.artwork.url" size="190" images="1"></artwork-material>
</div> </div>
</div> </div>
<div class="floating-header" :style="{opacity: (headerVisible ? 0 : 1),'pointer-events': (headerVisible ? 'none' : '')}"> <div class="floating-header" :style="{opacity: (headerVisible ? 0 : 1),'pointer-events': (headerVisible ? 'none' : '')}">
@ -143,18 +143,9 @@
return { return {
topSongsExpanded: false, topSongsExpanded: false,
app: this.$root, app: this.$root,
headerVisible: true, headerVisible: true
artistimage : ''
} }
}, },
mounted: async function () {
this.artistimage = this.data.attributes?.artwork ? this.data.attributes.artwork?.url : ''
if (this.artistimage == '' && this.data.id != null){
this.artistimage = await this.app.loadArtistImage(this.data.id)
}
},
methods: { methods: {
isHeaderVisible(visible) { isHeaderVisible(visible) {
this.headerVisible = visible this.headerVisible = visible

View file

@ -259,7 +259,7 @@
let friends = badges[id] let friends = badges[id]
if (friends) { if (friends) {
friends.forEach(function (friend) { friends.forEach(function (friend) {
self.app.mk.api.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => { self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
self.itemBadges.push(data.data.data[0]) self.itemBadges.push(data.data.data[0])
}) })
}) })
@ -323,7 +323,7 @@
} }
let kind = this.data.attributes.playParams.kind ?? this.data.type ?? ''; let kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
app.mk.api.music(`v1/me/library/${truekind}/${id.toString()}`, {}, app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`, {},
{ {
fetchOptions: { fetchOptions: {
method: "DELETE" method: "DELETE"
@ -369,7 +369,7 @@
return return
} }
console.log('sds', this.convert()) console.log('sds', this.convert())
await app.mk.api.music( await app.mk.api.v3.music(
`/v1/me/library/playlists/${this.data.attributes.playParams.id}/tracks`, `/v1/me/library/playlists/${this.data.attributes.playParams.id}/tracks`,
{}, {},
{ {
@ -449,7 +449,7 @@
if (route === '') { if (route === '') {
return return
} }
app.mk.api.music(route).then(res => { app.mk.api.v3.music(route).then(res => {
console.log(res.data.data[0].attributes.url) console.log(res.data.data[0].attributes.url)
app.copyToClipboard(res.data.data[0].attributes.url) app.copyToClipboard(res.data.data[0].attributes.url)
}) })

View file

@ -84,7 +84,7 @@
} }
this.loading = true this.loading = true
this.api.music(this.data.next, app.collectionList.requestBody).then((response) => { this.api.v3.music(this.data.next, app.collectionList.requestBody).then((response) => {
console.log(response) console.log(response)
if (!app.collectionList.response.groups) { if (!app.collectionList.response.groups) {
this.data.data = this.data.data.concat(response.data.data); this.data.data = this.data.data.concat(response.data.data);

View file

@ -127,7 +127,7 @@
}, },
methods: { methods: {
async seeAllHistory() { async seeAllHistory() {
let hist = await app.mk.api.music(`/v1/me/recent/played/tracks`, { let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {
l: this.$root.mklang l: this.$root.mklang
}) })
app.showCollection(hist.data, app.getLz('term.history')) app.showCollection(hist.data, app.getLz('term.history'))
@ -160,14 +160,14 @@
} }
} }
if (playlists.length != 0) { if (playlists.length != 0) {
this.app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${playlists.toString()}`, { this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${playlists.toString()}`, {
l: this.$root.mklang l: this.$root.mklang
}).then(playlistsData => { }).then(playlistsData => {
self.favorites.push(...playlistsData.data) self.favorites.push(...playlistsData.data)
}) })
} }
if (libraryPlaylists.length != 0) { if (libraryPlaylists.length != 0) {
this.app.mk.api.music(`v1/me/library/playlists/${playlists.toString()}`, { this.app.mk.api.v3.music(`v1/me/library/playlists/${playlists.toString()}`, {
l: this.$root.mklang l: this.$root.mklang
}).then(playlistsData => { }).then(playlistsData => {
self.favorites.push(...playlistsData.data) self.favorites.push(...playlistsData.data)
@ -184,7 +184,7 @@
} }
try { try {
const chunkArtistData = await Promise.all(chunks.map(chunk => const chunkArtistData = await Promise.all(chunks.map(chunk =>
this.app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${chunk.toString()}&views=latest-release&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=2&art[url]=f`))) this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${chunk.toString()}&views=latest-release&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=2&art[url]=f`)))
chunkArtistData.forEach(chunkResult => chunkArtistData.forEach(chunkResult =>
chunkResult.data.data.forEach(item => { chunkResult.data.data.forEach(item => {
if (item.views["latest-release"].data.length != 0) { if (item.views["latest-release"].data.length != 0) {
@ -204,7 +204,7 @@
}, },
async getListenNowData() { async getListenNowData() {
let self = this let self = this
this.app.mk.api.music(`/v1/me/recommendations?timezone=${encodeURIComponent(app.formatTimezoneOffset())}&name=listen-now&with=friendsMix,library&art[social-profiles:url]=c&art[url]=c,f&omit[resource]=autos&relate[editorial-items]=contents&extend=editorialCard,editorialVideo&extend[albums]=artistUrl&extend[library-albums]=artistUrl,editorialVideo&extend[playlists]=artistNames,editorialArtwork,editorialVideo&extend[library-playlists]=artistNames,editorialArtwork,editorialVideo&extend[social-profiles]=topGenreNames&include[albums]=artists&include[songs]=artists&include[music-videos]=artists&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url&fields[artists]=name,url&extend[stations]=airDate,supportsAirTimeUpdates&meta[stations]=inflectionPoints&types=artists,albums,editorial-items,library-albums,library-playlists,music-videos,playlists,stations,activities,apple-curators,curators&platform=auto&l=${this.$root.mklang}`).then((data) => { this.app.mk.api.v3.music(`/v1/me/recommendations?timezone=${encodeURIComponent(app.formatTimezoneOffset())}&name=listen-now&with=friendsMix,library,social&art[social-profiles:url]=c&art[url]=c,f&omit[resource]=autos&relate[editorial-items]=contents&extend=editorialCard,editorialVideo&extend[albums]=artistUrl&extend[library-albums]=artistUrl,editorialVideo&extend[playlists]=artistNames,editorialArtwork,editorialVideo&extend[library-playlists]=artistNames,editorialArtwork,editorialVideo&extend[social-profiles]=topGenreNames&include[albums]=artists&include[songs]=artists&include[music-videos]=artists&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url&fields[artists]=name,url&extend[stations]=airDate,supportsAirTimeUpdates&meta[stations]=inflectionPoints&types=artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-upsells&platform=web&l=${this.$root.mklang}`).then((data) => {
console.log(data.data.data[1]) console.log(data.data.data[1])
try { try {
self.madeForYou = data.data.data.filter(section => { self.madeForYou = data.data.data.filter(section => {
@ -227,7 +227,7 @@
self.sectionsReady.push("friendsListeningTo") self.sectionsReady.push("friendsListeningTo")
}); });
app.mk.api.music("/v1/me/social/profile/").then((response) => { app.mk.api.v3.music("/v1/me/social/profile/").then((response) => {
self.profile = response.data.data[0] self.profile = response.data.data[0]
}) })

View file

@ -30,7 +30,7 @@
mounted() { mounted() {
this.$nextTick(async function () { this.$nextTick(async function () {
if (this.$data.videos == null || this.$data.videos.length == 0) if (this.$data.videos == null || this.$data.videos.length == 0)
this.$data.videos = (await this.$root.mk.api.music('/v1/me/library/music-videos')).data?.data ?? [] this.$data.videos = (await this.$root.mk.api.v3.music('/v1/me/library/music-videos')).data?.data ?? []
this.$data.loaded = true this.$data.loaded = true
}) })
} }

View file

@ -1,8 +1,8 @@
<script type="text/x-template" id="cider-listen-now"> <script type="text/x-template" id="cider-listen-now">
<div class="content-inner"> <div class="content-inner">
<h1 class="header-text">{{app.getLz('term.listenNow')}}</h1> <h1 class="header-text">{{app.getLz('term.listenNow')}}</h1>
<template v-for="(recom, index) in data.data"> <template v-for="recom in data.data">
<listennow-child :index="index" :recom="recom"></listennow-child> <listennow-child :recom="recom"></listennow-child>
</template> </template>
</div> </div>
</script> </script>

View file

@ -283,7 +283,7 @@
let friends = badges[id] let friends = badges[id]
if (friends) { if (friends) {
friends.forEach(function (friend) { friends.forEach(function (friend) {
self.app.mk.api.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => { self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
self.itemBadges.push(data.data.data[0]) self.itemBadges.push(data.data.data[0])
}) })
}) })
@ -347,7 +347,7 @@
} }
let kind = this.data.attributes.playParams.kind ?? this.data.type ?? ''; let kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
app.mk.api.music(`v1/me/library/${truekind}/${id.toString()}`, {}, app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`, {},
{ {
fetchOptions: { fetchOptions: {
method: "DELETE" method: "DELETE"
@ -393,7 +393,7 @@
return return
} }
console.log('sds', this.convert()) console.log('sds', this.convert())
await app.mk.api.music( await app.mk.api.v3.music(
`/v1/me/library/playlists/${this.data.attributes.playParams.id}/tracks`, `/v1/me/library/playlists/${this.data.attributes.playParams.id}/tracks`,
{}, {},
{ {
@ -473,7 +473,7 @@
if (route === '') { if (route === '') {
return return
} }
app.mk.api.music(route).then(res => { app.mk.api.v3.music(route).then(res => {
console.log(res.data.data[0].attributes.url) console.log(res.data.data[0].attributes.url)
app.copyToClipboard(res.data.data[0].attributes.url) app.copyToClipboard(res.data.data[0].attributes.url)
}) })

View file

@ -165,7 +165,7 @@
} }
}, },
async mounted() { async mounted() {
let podcastShow = await app.mk.api.podcasts(`/v1/me/library/podcasts?include=episodes`) let podcastShow = await app.mk.api.v3.podcasts(`/v1/me/library/podcasts?include=episodes`)
this.podcasts = podcastShow.data.data this.podcasts = podcastShow.data.data
if (podcastShow.data.next) { if (podcastShow.data.next) {
await this.getNext(podcastShow.data.next) await this.getNext(podcastShow.data.next)
@ -190,7 +190,7 @@
if(this.search.term == "") { if(this.search.term == "") {
return return
} }
app.mk.api.podcasts("/v1/catalog/us/search", {term: this.search.term, types: ["podcasts"], limit: 25}).then(response => { app.mk.api.v3.podcasts("/v1/catalog/us/search", {term: this.search.term, types: ["podcasts"], limit: 25}).then(response => {
console.log(response) console.log(response)
self.search.results = response.data.results.podcasts.data self.search.results = response.data.results.podcasts.data
}) })
@ -215,7 +215,7 @@
}, },
async getEpisodes(podcast) { async getEpisodes(podcast) {
this.episodes = [] this.episodes = []
let eps = await app.mk.api.podcasts(`/v1/catalog/${app.mk.storefrontId}/podcasts/${podcast.id}?include=episodes`) let eps = await app.mk.api.v3.podcasts(`/v1/catalog/${app.mk.storefrontId}/podcasts/${podcast.id}?include=episodes`)
eps.data.data[0].relationships.episodes.data.forEach(ep => { eps.data.data[0].relationships.episodes.data.forEach(ep => {
this.episodes.push(ep) this.episodes.push(ep)
@ -226,7 +226,7 @@
}, },
async getNextEpisodes(next, podcastId) { async getNextEpisodes(next, podcastId) {
let podcastShow = await app.mk.api.podcasts(next) let podcastShow = await app.mk.api.v3.podcasts(next)
if(podcastId != this.podcastSelected.id) { if(podcastId != this.podcastSelected.id) {
return return
} }
@ -238,7 +238,7 @@
} }
}, },
async getNext(next) { async getNext(next) {
let podcastShow = await app.mk.api.podcasts(next) let podcastShow = await app.mk.api.v3.podcasts(next)
this.podcasts = this.podcasts.concat(podcastShow.data.data) this.podcasts = this.podcasts.concat(podcastShow.data.data)
if (podcastShow.data.next) { if (podcastShow.data.next) {
await this.getNext(podcastShow.data.next) await this.getNext(podcastShow.data.next)

View file

@ -97,12 +97,12 @@
}, },
async mounted() { async mounted() {
// Get available years // Get available years
let year = await app.mk.api.music("/v1/me/music-summaries/search?extend=inLibrary&period=year&fields[music-summaries]=period%2Cyear&include[music-summaries]=playlist") let year = await app.mk.api.v3.music("/v1/me/music-summaries/search?extend=inLibrary&period=year&fields[music-summaries]=period%2Cyear&include[music-summaries]=playlist")
this.years = year.data.data this.years = year.data.data
this.years.reverse() this.years.reverse()
localStorage.setItem("seenReplay", true) localStorage.setItem("seenReplay", true)
this.getReplayYear(); this.getReplayYear();
const musicGenre = await app.mk.api.music(`/v1/catalog/${app.mk.storefrontId}/genres/34`) const musicGenre = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/genres/34`)
this.musicTypeGenre = musicGenre.data.data[0].attributes.name this.musicTypeGenre = musicGenre.data.data[0].attributes.name
}, },
methods: { methods: {
@ -145,10 +145,10 @@
}, },
async getReplayYear(year = new Date().getFullYear()) { async getReplayYear(year = new Date().getFullYear()) {
this.loaded.id = -1 this.loaded.id = -1
let response = await app.mk.api.music(`/v1/me/music-summaries/year-${year}?extend=inLibrary&views=top-artists%2Ctop-albums%2Ctop-songs&include[music-summaries]=playlist&include[playlists]=tracks&includeOnly=playlist%2Ctracks%2Csong%2Cartist%2Calbum`) let response = await app.mk.api.v3.music(`/v1/me/music-summaries/year-${year}?extend=inLibrary&views=top-artists%2Ctop-albums%2Ctop-songs&include[music-summaries]=playlist&include[playlists]=tracks&includeOnly=playlist%2Ctracks%2Csong%2Cartist%2Calbum`)
let replayData = response.data.data[0] let replayData = response.data.data[0]
// extended playlist // extended playlist
let playlist = await app.mk.api.music(replayData.relationships.playlist.data[0].href, {extend: "editorialArtwork,editorialVideo"}) let playlist = await app.mk.api.v3.music(replayData.relationships.playlist.data[0].href, {extend: "editorialArtwork,editorialVideo"})
replayData.playlist = playlist.data.data[0] replayData.playlist = playlist.data.data[0]
this.loaded = replayData this.loaded = replayData
} }

View file

@ -116,7 +116,7 @@
}, },
async getCategories() { async getCategories() {
if (this.categoriesView != [] && this.categoriesView.length > 0) { this.categoriesReady = true; return await true; } else { if (this.categoriesView != [] && this.categoriesView.length > 0) { this.categoriesReady = true; return await true; } else {
let response = await this.app.mk.api.music(`/v1/recommendations/${this.app.mk.storefrontId}?timezone=${encodeURIComponent(this.app.formatTimezoneOffset())}&name=search-landing&platform=auto&extend=editorialArtwork&art%5Burl%5D=f%2Cc&types=editorial-items%2Capple-curators%2Cactivities&l=${this.$root.mklang}`); let response = await this.app.mk.api.v3.music(`/v1/recommendations/${this.app.mk.storefrontId}?timezone=${encodeURIComponent(this.app.formatTimezoneOffset())}&name=search-landing&platform=web&extend=editorialArtwork&art%5Burl%5D=f%2Cc&types=editorial-items%2Capple-curators%2Cactivities&l=${this.$root.mklang}`);
this.categoriesView = response.data.data; this.categoriesView = response.data.data;
console.log(this.categoriesView) console.log(this.categoriesView)
this.categoriesReady = true; this.categoriesReady = true;

View file

@ -21,7 +21,7 @@
} }
}, },
async mounted() { async mounted() {
app.mk.api.music("/v1/catalog/us/artists/669831761").then(response => { app.mk.api.v3.music("/v1/catalog/us/artists/669831761").then(response => {
this.artist = response.data.data[0]; this.artist = response.data.data[0];
this.artistLoaded = true; this.artistLoaded = true;
}); });

View file

@ -145,7 +145,7 @@
let friends = this.badges[id] let friends = this.badges[id]
if (friends) { if (friends) {
friends.forEach(function (friend) { friends.forEach(function (friend) {
self.app.mk.api.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => { self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
self.itemBadges.push(data.data.data[0]) self.itemBadges.push(data.data.data[0])
}) })
}) })
@ -186,7 +186,7 @@
} }
let kind = this.item.attributes.playParams.kind ?? this.item.type ?? ''; let kind = this.item.attributes.playParams.kind ?? this.item.type ?? '';
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
app.mk.api.music(`v1/me/library/${truekind}/${id.toString()}`,{}, app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
{ {
fetchOptions: { fetchOptions: {
method: "DELETE" method: "DELETE"