Merge branch 'musickit-v3' into typescript
This commit is contained in:
commit
2f57d9bb3f
11 changed files with 338 additions and 252 deletions
|
@ -382,9 +382,9 @@ const app = new Vue({
|
||||||
}) {
|
}) {
|
||||||
let self = this
|
let self = this
|
||||||
try {
|
try {
|
||||||
app.mk.api.socialBadgingMap().then(data => {
|
app.mk.api.v3.music("/v1/social/badging-map").then(data => {
|
||||||
self.socialBadges.badgeMap = data.badgingMap
|
self.socialBadges.badgeMap = data.data.results.badgingMap
|
||||||
cb(data.badgingMap)
|
cb(data.data.results.badgingMap)
|
||||||
})
|
})
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this.socialBadges.badgeMap = {}
|
this.socialBadges.badgeMap = {}
|
||||||
|
@ -435,9 +435,9 @@ const app = new Vue({
|
||||||
type: self.selectedMediaItems[i].kind
|
type: self.selectedMediaItems[i].kind
|
||||||
})
|
})
|
||||||
} 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.albumRelationship(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.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)
|
||||||
|
@ -449,8 +449,8 @@ 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.library.albumRelationship(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.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)
|
||||||
|
@ -463,7 +463,18 @@ const app = new Vue({
|
||||||
|
|
||||||
}
|
}
|
||||||
this.modals.addToPlaylist = false
|
this.modals.addToPlaylist = false
|
||||||
this.mk.api.library.appendTracksToPlaylist(playlist_id, pl_items).then(() => {
|
await app.mk.api.v3.music(
|
||||||
|
`/v1/me/library/playlists/${playlist_id}/tracks`,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
data: pl_items
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
if (this.page == 'playlist_' + this.showingPlaylist.id) {
|
if (this.page == 'playlist_' + this.showingPlaylist.id) {
|
||||||
this.getPlaylistFromID(this.showingPlaylist.id)
|
this.getPlaylistFromID(this.showingPlaylist.id)
|
||||||
}
|
}
|
||||||
|
@ -485,8 +496,12 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
this.mk._services.timing.mode = 0
|
this.mk._services.timing.mode = 0
|
||||||
this.platform = ipcRenderer.sendSync('cider-platform');
|
this.platform = ipcRenderer.sendSync('cider-platform');
|
||||||
// Set profile name
|
|
||||||
this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "")
|
try{
|
||||||
|
// Set profile name
|
||||||
|
this.chrome.userinfo = (await app.mk.api.v3.music(`/v1/me/social-profile`)).data.data[0]
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
// API Fallback
|
// API Fallback
|
||||||
if (!this.chrome.userinfo) {
|
if (!this.chrome.userinfo) {
|
||||||
this.chrome.userinfo = {
|
this.chrome.userinfo = {
|
||||||
|
@ -618,8 +633,8 @@ const app = new Vue({
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
if (!previewURL) {
|
if (!previewURL) {
|
||||||
app.mk.api.song(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.relationships.catalog.data[0].id}`).then((response) => {
|
||||||
previewURL = response.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)
|
||||||
})
|
})
|
||||||
|
@ -824,7 +839,24 @@ const app = new Vue({
|
||||||
if (tracks.length > 0) {
|
if (tracks.length > 0) {
|
||||||
request.tracks = tracks
|
request.tracks = tracks
|
||||||
}
|
}
|
||||||
app.mk.api.library.createPlaylist(request).then(res => {
|
app.mk.api.v3.music(`/v1/me/library/playlists`, {},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(
|
||||||
|
{
|
||||||
|
"attributes":
|
||||||
|
{ "name": name },
|
||||||
|
"relationships":
|
||||||
|
{ "tracks":
|
||||||
|
{ "data": tracks },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(res => {
|
||||||
|
res = res.data.data[0]
|
||||||
console.log(res)
|
console.log(res)
|
||||||
self.appRoute(`playlist_` + res.id);
|
self.appRoute(`playlist_` + res.id);
|
||||||
self.showingPlaylist = [];
|
self.showingPlaylist = [];
|
||||||
|
@ -845,7 +877,13 @@ const app = new Vue({
|
||||||
deletePlaylist(id) {
|
deletePlaylist(id) {
|
||||||
let self = this
|
let self = this
|
||||||
if (confirm(`Are you sure you want to delete this playlist?`)) {
|
if (confirm(`Are you sure you want to delete this playlist?`)) {
|
||||||
app.mk.api.library.deletePlaylist(id).then(res => {
|
app.mk.api.v3.music(`/v1/me/library/playlists/${id}`, {},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "DELETE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(res => {
|
||||||
// remove this playlist from playlists.listing if it exists
|
// remove this playlist from playlists.listing if it exists
|
||||||
let found = self.playlists.listing.find(item => item.id == id)
|
let found = self.playlists.listing.find(item => item.id == id)
|
||||||
if (found) {
|
if (found) {
|
||||||
|
@ -862,15 +900,16 @@ 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 this.mk.api.artistView(artist, view, {}, {view: view, includeResponseMeta: !0})
|
let response = (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artist}/view/${view}`)).data
|
||||||
|
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 this.mk.api.recordLabelView(label, view, {}, {view: view, includeResponseMeta: !0})
|
let response = (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/record-labels/${label}/view/${view}`)).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 response = await this.mk.api.search(term, {
|
let response = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search?term=${term}`, {
|
||||||
platform: "web",
|
platform: "web",
|
||||||
groups: group,
|
groups: group,
|
||||||
types: "activities,albums,apple-curators,artists,curators,editorial-items,music-movies,music-videos,playlists,songs,stations,tv-episodes,uploaded-videos,record-labels",
|
types: "activities,albums,apple-curators,artists,curators,editorial-items,music-movies,music-videos,playlists,songs,stations,tv-episodes,uploaded-videos,record-labels",
|
||||||
|
@ -894,17 +933,19 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
omit: {
|
omit: {
|
||||||
resource: ["autos"]
|
resource: ["autos"]
|
||||||
}
|
},
|
||||||
}, {groups: group, includeResponseMeta: !0})
|
groups: group
|
||||||
console.log(response)
|
})
|
||||||
|
console.log('searchres',response)
|
||||||
let responseFormat = {
|
let responseFormat = {
|
||||||
data: response[group].data.data,
|
data: response.data.results[group].data,
|
||||||
next: response[group].next,
|
next: response.data.results[group].data,
|
||||||
groups: group
|
groups: group
|
||||||
}
|
}
|
||||||
await this.showCollection(responseFormat, title, "search")
|
await this.showCollection(responseFormat, title, "search")
|
||||||
},
|
},
|
||||||
async getPlaylistContinuous(response, transient = false) {
|
async getPlaylistContinuous(response, transient = false) {
|
||||||
|
response = response.data.data[0]
|
||||||
let self = this
|
let self = this
|
||||||
let playlistId = response.id
|
let playlistId = response.id
|
||||||
if (!transient) this.playlists.loadingState = 0
|
if (!transient) this.playlists.loadingState = 0
|
||||||
|
@ -937,30 +978,26 @@ const app = new Vue({
|
||||||
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,playParams",
|
||||||
"include[library-songs]": "catalog,artists,albums",
|
"include[library-songs]": "catalog,artists,albums,playParams,name,artwork,url",
|
||||||
"fields[catalog]": "artistUrl,albumUrl",
|
"fields[catalog]": "artistUrl,albumUrl,url",
|
||||||
"fields[songs]": "artistUrl,albumUrl"
|
"fields[songs]": "artistUrl,albumUrl,playParams,name,artwork,url,artistName,albumName,durationInMillis"
|
||||||
}
|
}
|
||||||
if (!transient) {
|
if (!transient) {
|
||||||
this.playlists.loadingState = 0;
|
this.playlists.loadingState = 0;
|
||||||
}
|
}
|
||||||
let playlistId = ''
|
app.mk.api.v3.music(`/v1/me/library/playlists/${id}`, params).then(res => {
|
||||||
|
|
||||||
try {
|
|
||||||
app.mk.api.library.playlist(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.library.playlist(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) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
async getArtistFromID(id) {
|
async getArtistFromID(id) {
|
||||||
|
@ -973,8 +1010,8 @@ const app = new Vue({
|
||||||
"limit[artists:top-songs]": 20,
|
"limit[artists:top-songs]": 20,
|
||||||
"art[url]": "f"
|
"art[url]": "f"
|
||||||
}, {includeResponseMeta: !0})
|
}, {includeResponseMeta: !0})
|
||||||
console.log(artistData)
|
console.log(artistData.data.data[0])
|
||||||
this.artistPage.data = artistData.data[0]
|
this.artistPage.data = artistData.data.data[0]
|
||||||
this.page = "artist-page"
|
this.page = "artist-page"
|
||||||
},
|
},
|
||||||
progressBarStyle() {
|
progressBarStyle() {
|
||||||
|
@ -1023,7 +1060,7 @@ const app = new Vue({
|
||||||
this.search.hints = []
|
this.search.hints = []
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let hints = await app.mkapi("searchHints", false, this.search.term)
|
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() {
|
||||||
|
@ -1137,7 +1174,7 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
async getNowPlayingItemDetailed(target) {
|
async getNowPlayingItemDetailed(target) {
|
||||||
let u = await app.mkapi(app.mk.nowPlayingItem.playParams.kind, (app.mk.nowPlayingItem.songId == -1), (app.mk.nowPlayingItem.songId != -1) ? app.mk.nowPlayingItem.songId : app.mk.nowPlayingItem["id"], {"include[songs]": "albums,artists"});
|
let u = await app.mkapi(app.mk.nowPlayingItem.playParams.kind, (app.mk.nowPlayingItem.songId == -1), (app.mk.nowPlayingItem.songId != -1) ? app.mk.nowPlayingItem.songId : app.mk.nowPlayingItem["id"], {"include[songs]": "albums,artists"});
|
||||||
app.searchAndNavigate(u, target)
|
app.searchAndNavigate(u.data.data[0], target)
|
||||||
},
|
},
|
||||||
async searchAndNavigate(item, target) {
|
async searchAndNavigate(item, target) {
|
||||||
let self = this
|
let self = this
|
||||||
|
@ -1162,10 +1199,10 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (artistId == "") {
|
if (artistId == "") {
|
||||||
let artistQuery = await app.mk.api.search(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;
|
||||||
try {
|
try {
|
||||||
if (artistQuery.artists.data.length > 0) {
|
if (artistQuery.artists.data.length > 0) {
|
||||||
artistId = artistQuery.artists.data[0].id;
|
artistId = artistQuery.artists.data[0].id;
|
||||||
|
@ -1198,10 +1235,10 @@ const app = new Vue({
|
||||||
|
|
||||||
if (albumId == "") {
|
if (albumId == "") {
|
||||||
try {
|
try {
|
||||||
let albumQuery = await app.mk.api.search(item.attributes.albumName + " " + (item.attributes.artistName ?? ""), {
|
let albumQuery =(await app.mk.api.v3.music(`v1/catalog/${app.mk.storefrontId}/search?term=${item.attributes.albumName + " " + (item.attributes.artistName ?? "")}`,{
|
||||||
limit: 1,
|
limit: 1,
|
||||||
types: 'albums'
|
types: 'albums'
|
||||||
})
|
})).data.results;
|
||||||
if (albumQuery.albums.data.length > 0) {
|
if (albumQuery.albums.data.length > 0) {
|
||||||
albumId = albumQuery.albums.data[0].id;
|
albumId = albumQuery.albums.data[0].id;
|
||||||
console.log(albumId)
|
console.log(albumId)
|
||||||
|
@ -1222,10 +1259,10 @@ const app = new Vue({
|
||||||
|
|
||||||
if (labelId == "") {
|
if (labelId == "") {
|
||||||
try {
|
try {
|
||||||
let labelQuery = await app.mk.api.search(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;
|
||||||
if (labelQuery["record-labels"].data.length > 0) {
|
if (labelQuery["record-labels"].data.length > 0) {
|
||||||
labelId = labelQuery["record-labels"].data[0].id;
|
labelId = labelQuery["record-labels"].data[0].id;
|
||||||
console.log(labelId)
|
console.log(labelId)
|
||||||
|
@ -1350,14 +1387,14 @@ const app = new Vue({
|
||||||
a = []
|
a = []
|
||||||
} finally {
|
} finally {
|
||||||
if (kind == "appleCurator") {
|
if (kind == "appleCurator") {
|
||||||
app.appleCurator = a
|
app.appleCurator = a.data.data[0]
|
||||||
} else {
|
} else {
|
||||||
this.getPlaylistContinuous(a)
|
this.getPlaylistContinuous(a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (kind == "appleCurator") {
|
if (kind == "appleCurator") {
|
||||||
app.appleCurator = a
|
app.appleCurator = a.data.data[0]
|
||||||
} else {
|
} else {
|
||||||
this.getPlaylistContinuous(a)
|
this.getPlaylistContinuous(a)
|
||||||
}
|
}
|
||||||
|
@ -1566,14 +1603,17 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mkapi(method, library = false, term, params = {}, params2 = {}, attempts = 0) {
|
async mkapi(method, library = false, term, params = {}, params2 = {}, attempts = 0) {
|
||||||
|
if (method.includes(`recordLabel`)){method = `record-labels`}
|
||||||
|
if (method.includes(`appleCurator`)){method = `apple-curators`}
|
||||||
if (attempts > 3) {
|
if (attempts > 3) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let truemethod = (!method.endsWith("s")) ? (method + "s") : method;
|
||||||
try {
|
try {
|
||||||
if (library) {
|
if (library) {
|
||||||
return await this.mk.api.library[method](term, params, params2)
|
return await this.mk.api.v3.music(`v1/me/library/${truemethod}/${term.toString()}`, params, params2)
|
||||||
} else {
|
} else {
|
||||||
return await this.mk.api[method](term, 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)
|
||||||
|
@ -1625,14 +1665,14 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
self.library.songs.downloadState = 1
|
self.library.songs.downloadState = 1
|
||||||
if (downloaded == null) {
|
if (downloaded == null) {
|
||||||
app.mk.api.library.songs("", params, {includeResponseMeta: !0}).then((response) => {
|
app.mk.api.v3.music(`/v1/me/library/songs/`, params).then((response) => {
|
||||||
processChunk(response)
|
processChunk(response.data)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (downloaded.next != null && typeof downloaded.next === "function") {
|
if (downloaded.next != null) {
|
||||||
downloaded.next("", params, {includeResponseMeta: !0}).then((response) => {
|
app.mk.api.v3.music(downloaded.next, params).then((response) => {
|
||||||
processChunk(response)
|
processChunk(response.data)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log("Download next", downloaded.next)
|
console.log("Download next", downloaded.next)
|
||||||
|
@ -1706,13 +1746,13 @@ const app = new Vue({
|
||||||
limit: 100,
|
limit: 100,
|
||||||
}
|
}
|
||||||
if (downloaded == null) {
|
if (downloaded == null) {
|
||||||
app.mk.api.library.albums("", params, {includeResponseMeta: !0}).then((response) => {
|
app.mk.api.v3.music(`/v1/me/library/albums/`, params).then((response) => {
|
||||||
processChunk(response)
|
processChunk(response.data)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (downloaded.next != null && typeof downloaded.next === "function") {
|
if (downloaded.next != null) {
|
||||||
downloaded.next("", params, {includeResponseMeta: !0}).then((response) => {
|
app.mk.api.v3.music(downloaded.next, params).then((response) => {
|
||||||
processChunk(response)
|
processChunk(response.data)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log("Download next", downloaded.next)
|
console.log("Download next", downloaded.next)
|
||||||
|
@ -1787,13 +1827,14 @@ const app = new Vue({
|
||||||
limit: 100,
|
limit: 100,
|
||||||
}
|
}
|
||||||
if (downloaded == null) {
|
if (downloaded == null) {
|
||||||
app.mk.api.library.artists("", params, {includeResponseMeta: !0}).then((response) => {
|
app.mk.api.v3.music(`/v1/me/library/artists/`, params).then((response) => {
|
||||||
processChunk(response)
|
processChunk(response.data)
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (downloaded.next != null && typeof downloaded.next === "function") {
|
if (downloaded.next != null) {
|
||||||
downloaded.next("", "artists", {includeResponseMeta: !0}).then((response) => {
|
app.mk.api.v3.music(downloaded.next, params).then((response) => {
|
||||||
processChunk(response)
|
processChunk(response.data)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log("Download next", downloaded.next)
|
console.log("Download next", downloaded.next)
|
||||||
|
@ -1852,20 +1893,20 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
async getLibrarySongs() {
|
async getLibrarySongs() {
|
||||||
let response = await this.mkapi("songs", true, "", {limit: 100}, {includeResponseMeta: !0})
|
let response = await this.mkapi("songs", true, "", {limit: 100}, {includeResponseMeta: !0})
|
||||||
this.library.songs.listing = response.data
|
this.library.songs.listing = response.data.data
|
||||||
this.library.songs.meta = response.meta
|
this.library.songs.meta = response.data.meta
|
||||||
},
|
},
|
||||||
async getLibraryAlbums() {
|
async getLibraryAlbums() {
|
||||||
let response = await this.mkapi("albums", true, "", {limit: 100}, {includeResponseMeta: !0})
|
let response = await this.mkapi("albums", true, "", {limit: 100}, {includeResponseMeta: !0})
|
||||||
this.library.albums.listing = response.data
|
this.library.albums.listing = response.data.data
|
||||||
this.library.albums.meta = response.meta
|
this.library.albums.meta = response.data.meta
|
||||||
},
|
},
|
||||||
async getListenNow(attempt = 0) {
|
async getListenNow(attempt = 0) {
|
||||||
if (attempt > 3) {
|
if (attempt > 3) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.listennow = await this.mk.api.personalRecommendations("",
|
this.listennow = (await this.mk.api.v3.music(`v1/me/recommendations?timezone=${encodeURIComponent(this.formatTimezoneOffset())}`,
|
||||||
{
|
{
|
||||||
name: "listen-now",
|
name: "listen-now",
|
||||||
with: "friendsMix,library,social",
|
with: "friendsMix,library,social",
|
||||||
|
@ -1892,7 +1933,7 @@ const app = new Vue({
|
||||||
{
|
{
|
||||||
includeResponseMeta: !0,
|
includeResponseMeta: !0,
|
||||||
reload: !0
|
reload: !0
|
||||||
});
|
})).data;
|
||||||
console.log(this.listennow)
|
console.log(this.listennow)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
@ -1904,19 +1945,18 @@ const app = new Vue({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let browse = await this.mk.api.groupings("",
|
let browse = await app.mk.api.v3.music(`/v1/editorial/${app.mk.storefrontId}/groupings`, {
|
||||||
{
|
platform: "web",
|
||||||
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",
|
"include[music-videos]": "artists",
|
||||||
"include[music-videos]": "artists",
|
extend: "editorialArtwork,artistUrl",
|
||||||
extend: "editorialArtwork,artistUrl",
|
"fields[artists]": "name,url,artwork,editorialArtwork,genreNames,editorialNotes",
|
||||||
"fields[artists]": "name,url,artwork,editorialArtwork,genreNames,editorialNotes",
|
"art[url]": "f"
|
||||||
"art[url]": "f"
|
});
|
||||||
});
|
this.browsepage = browse.data.data[0];
|
||||||
this.browsepage = browse[0];
|
|
||||||
console.log(this.browsepage)
|
console.log(this.browsepage)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
@ -1928,11 +1968,11 @@ const app = new Vue({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.radio.personal = await this.mkapi("recentRadioStations", false, "",
|
this.radio.personal = (await app.mk.api.v3.music(`/v1/me/recent/radio-stations`,
|
||||||
{
|
{
|
||||||
"platform": "web",
|
"platform": "web",
|
||||||
"art[url]": "f"
|
"art[url]": "f"
|
||||||
});
|
})).data.data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
this.getRadioStations(attempt + 1)
|
this.getRadioStations(attempt + 1)
|
||||||
|
@ -2018,7 +2058,11 @@ 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;
|
||||||
this.mk.api.library.remove({[truekind]: id}).then((data) => {
|
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "DELETE"
|
||||||
|
}}).then((data) => {
|
||||||
self.getLibrarySongsFull(true)
|
self.getLibrarySongsFull(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -2558,7 +2602,8 @@ const app = new Vue({
|
||||||
if (term == "") {
|
if (term == "") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.mk.api.search(this.search.term,
|
//this.mk.api.v3.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}`,
|
||||||
{
|
{
|
||||||
types: "activities,albums,apple-curators,artists,curators,editorial-items,music-movies,music-videos,playlists,songs,stations,tv-episodes,uploaded-videos,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",
|
||||||
|
@ -2576,16 +2621,19 @@ const app = new Vue({
|
||||||
"platform": "web",
|
"platform": "web",
|
||||||
limit: 25
|
limit: 25
|
||||||
}).then(function (results) {
|
}).then(function (results) {
|
||||||
self.search.results = results
|
results.data.results["meta"] = results.data.meta
|
||||||
|
self.search.results = results.data.results
|
||||||
})
|
})
|
||||||
await this.mk.api.socialSearch(this.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) {
|
||||||
self.search.resultsSocial = results
|
results.data.results["meta"] = results.data.meta
|
||||||
|
self.search.resultsSocial = results.data.results
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async inLibrary(items = []) {
|
async inLibrary(items = []) {
|
||||||
|
@ -2608,11 +2656,18 @@ const app = new Vue({
|
||||||
types[index].id.push(id)
|
types[index].id.push(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await this.mk.api.catalogResources(types, {
|
types2 = types.map(function(item){return {[`ids[${item.type}]`]: [item.id]}})
|
||||||
|
types2 = types2.reduce(function(result, item) {
|
||||||
|
var key = Object.keys(item)[0]; //first property: a, b, c
|
||||||
|
result[key] = item[key];
|
||||||
|
return result;
|
||||||
|
}, {});
|
||||||
|
return (await
|
||||||
|
this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}`, {...{
|
||||||
"omit[resource]": "autos",
|
"omit[resource]": "autos",
|
||||||
relate: "library",
|
relate: "library",
|
||||||
fields: "inLibrary"
|
fields: "inLibrary"
|
||||||
})
|
},...types2})).data.data
|
||||||
},
|
},
|
||||||
isInLibrary(playParams) {
|
isInLibrary(playParams) {
|
||||||
let self = this
|
let self = this
|
||||||
|
@ -2777,7 +2832,8 @@ const app = new Vue({
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let data = await this.mk.api.library.song(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];
|
||||||
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);
|
||||||
try {
|
try {
|
||||||
|
@ -2798,9 +2854,9 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
async setLibraryArt() {
|
async setLibraryArt() {
|
||||||
if (typeof this.mk.nowPlayingItem === "undefined") return;
|
if (typeof this.mk.nowPlayingItem === "undefined") return;
|
||||||
const data = await this.mk.api.library.song(this.mk.nowPlayingItem["id"])
|
|
||||||
try {
|
try {
|
||||||
const data = await this.mk.api.library.song(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];
|
||||||
|
|
||||||
if (data != null && data !== "") {
|
if (data != null && data !== "") {
|
||||||
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', 'url("' + (data["attributes"]["artwork"]["url"]).toString() + '")');
|
document.querySelector('.app-playback-controls .artwork').style.setProperty('--artwork', 'url("' + (data["attributes"]["artwork"]["url"]).toString() + '")');
|
||||||
|
@ -2812,9 +2868,9 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
async setLibraryArtBG() {
|
async setLibraryArtBG() {
|
||||||
if (typeof this.mk.nowPlayingItem === "undefined") return;
|
if (typeof this.mk.nowPlayingItem === "undefined") return;
|
||||||
const data = await this.mk.api.library.song(this.mk.nowPlayingItem["id"])
|
|
||||||
try {
|
try {
|
||||||
const data = await this.mk.api.library.song(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];
|
||||||
|
|
||||||
if (data != null && data !== "") {
|
if (data != null && data !== "") {
|
||||||
getBase64FromUrl((data["attributes"]["artwork"]["url"]).toString()).then(img => {
|
getBase64FromUrl((data["attributes"]["artwork"]["url"]).toString()).then(img => {
|
||||||
|
@ -2848,7 +2904,7 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
id = item.id
|
id = item.id
|
||||||
}
|
}
|
||||||
let response = await this.mk.api.v3.music(`/v1/me/ratings/${type}?platform=web&ids=${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
|
||||||
|
@ -2965,8 +3021,9 @@ 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.playlist(id).then(res => {
|
// this.mk.api.
|
||||||
callback(res)
|
this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`).then(res => {
|
||||||
|
callback(res.data.data[0])
|
||||||
})
|
})
|
||||||
|
|
||||||
// tracks are found in relationship.data
|
// tracks are found in relationship.data
|
||||||
|
@ -3175,7 +3232,22 @@ const app = new Vue({
|
||||||
ipcRenderer.send('setFullScreen', false);
|
ipcRenderer.send('setFullScreen', false);
|
||||||
app.appMode = 'player';
|
app.appMode = 'player';
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
formatTimezoneOffset : (e=new Date)=>{
|
||||||
|
let leadingZeros = (e,s=2)=>{
|
||||||
|
let n = "" + e;
|
||||||
|
for (; n.length < s; )
|
||||||
|
n = "0" + n;
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
const s = e.getTimezoneOffset()
|
||||||
|
, n = Math.floor(Math.abs(s) / 60)
|
||||||
|
, d = Math.round(Math.abs(s) % 60);
|
||||||
|
let h = "+";
|
||||||
|
return 0 !== s && (h = s > 0 ? "-" : "+"),
|
||||||
|
`${h}${leadingZeros(n, 2)}:${leadingZeros(d, 2)}`
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -70,14 +70,14 @@
|
||||||
},
|
},
|
||||||
async select(e) {
|
async select(e) {
|
||||||
let u = this.item
|
let u = this.item
|
||||||
let u1 = await app.mk.api.library.artistRelationship(u.id,"albums",
|
let u1 = await app.mk.api.v3.music(`/v1/me/library/artists/${u.id}/albums`,
|
||||||
{platform: "web",
|
{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",
|
||||||
"includeOnly": "catalog,artists"}
|
"includeOnly": "catalog,artists"}
|
||||||
)
|
)
|
||||||
app.showCollection({data : Object.assign({},u1)}, u.attributes.name?? '', '');
|
app.showCollection({data : Object.assign({},u1.data.data)}, u.attributes.name?? '', '');
|
||||||
},
|
},
|
||||||
getArtwork(){
|
getArtwork(){
|
||||||
let u = ""
|
let u = ""
|
||||||
|
|
|
@ -502,22 +502,21 @@
|
||||||
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 (){
|
||||||
var playlistId = id
|
var playlistId = id
|
||||||
function getPlaylist(id, params, isLibrary){
|
function getPlaylist(id, isLibrary){
|
||||||
if (isLibrary){
|
if (isLibrary){
|
||||||
return app.mk.api.library.playlist(id, params)
|
return this.app.mk.api.v3.music(`/v1/me/library/playlists/${id}`)
|
||||||
} else { return app.mk.api.playlist(id, params)}
|
} else { return this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`)}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
getPlaylist(id, 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); }
|
//if (app.mk.shuffleMode == 1){shuffleArray(query); }
|
||||||
// console.log(query)
|
// console.log(query)
|
||||||
// app.mk.queue.append(query)
|
// app.mk.queue.append(query)
|
||||||
if (!res.relationships.tracks.next) {
|
if (!res.data.relationships.tracks.next) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
getPlaylistTracks(res.relationships.tracks.next)
|
getPlaylistTracks(res.data.relationships.tracks.next)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlaylistTracks(next) {
|
function getPlaylistTracks(next) {
|
||||||
|
|
|
@ -122,7 +122,11 @@
|
||||||
}
|
}
|
||||||
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.library.remove({[truekind]: id})
|
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "DELETE"
|
||||||
|
}})
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
},
|
},
|
||||||
async contextMenu(event) {
|
async contextMenu(event) {
|
||||||
|
|
|
@ -96,6 +96,7 @@
|
||||||
if (this.item.type && !this.item.type.includes("library")) {
|
if (this.item.type && !this.item.type.includes("library")) {
|
||||||
var params = {"fields[playlists]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "extend": this.revisedRandId()}
|
var params = {"fields[playlists]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "extend": this.revisedRandId()}
|
||||||
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
||||||
|
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 {
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
|
@ -105,12 +106,17 @@
|
||||||
var params = {"fields[playlists]": "inLibrary","fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "extend": this.revisedRandId()}
|
var params = {"fields[playlists]": "inLibrary","fields[songs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library", "extend": this.revisedRandId()}
|
||||||
var id = this.item.id ?? this.item.attributes.playParams.id
|
var id = this.item.id ?? this.item.attributes.playParams.id
|
||||||
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
||||||
|
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
|
||||||
}
|
}
|
||||||
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.library.remove({[truekind]: id})
|
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "DELETE"
|
||||||
|
}})
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
},
|
},
|
||||||
subtitleSearchNavigate(item) {
|
subtitleSearchNavigate(item) {
|
||||||
|
|
|
@ -146,8 +146,8 @@
|
||||||
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.socialProfile(friend).then(data => {
|
self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
|
||||||
self.itemBadges.push(data)
|
self.itemBadges.push(data.data.data[0])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,7 @@
|
||||||
"extend": this.revisedRandId()
|
"extend": this.revisedRandId()
|
||||||
}
|
}
|
||||||
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
||||||
|
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 {
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
|
@ -180,12 +181,17 @@
|
||||||
}
|
}
|
||||||
var id = this.item.id ?? this.item.attributes.playParams.id
|
var id = this.item.id ?? this.item.attributes.playParams.id
|
||||||
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params);
|
||||||
|
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
|
||||||
}
|
}
|
||||||
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.library.remove({[truekind]: id})
|
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "DELETE"
|
||||||
|
}})
|
||||||
this.addedToLibrary = true
|
this.addedToLibrary = true
|
||||||
},
|
},
|
||||||
uuidv4() {
|
uuidv4() {
|
||||||
|
|
|
@ -181,7 +181,9 @@
|
||||||
this.children = []
|
this.children = []
|
||||||
this.getChildren()
|
this.getChildren()
|
||||||
this.toggleFolder()
|
this.toggleFolder()
|
||||||
this.$root.mk.api.library.playlistFolderChildren(item.id).then(children => {
|
|
||||||
|
this.$root.mk.api.v3.music(`v1/me/library/playlist-folders/${item.id}/children`).then(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)) {
|
||||||
child.parent = self.item.id
|
child.parent = self.item.id
|
||||||
|
|
|
@ -40,16 +40,8 @@
|
||||||
async getArtistFeed() {
|
async getArtistFeed() {
|
||||||
let artists = this.followedArtists
|
let artists = this.followedArtists
|
||||||
let self = this
|
let self = this
|
||||||
this.app.mk.api.artists(artists, {
|
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${artists.toString()}&views=featured-release,full-albums,appears-on-albums,featured-albums,featured-on-albums,singles,compilation-albums,live-albums,latest-release,top-music-videos,similar-artists,top-songs,playlists,more-to-hear,more-to-see&extend=artistBio,bornOrFormed,editorialArtwork,editorialVideo,isGroup,origin,hero&extend[playlists]=trackCount&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=20&art[url]=f`).then(artistData => {
|
||||||
"views": "featured-release,full-albums,appears-on-albums,featured-albums,featured-on-albums,singles,compilation-albums,live-albums,latest-release,top-music-videos,similar-artists,top-songs,playlists,more-to-hear,more-to-see",
|
artistData.data.data.forEach(item => {
|
||||||
"extend": "artistBio,bornOrFormed,editorialArtwork,editorialVideo,isGroup,origin,hero",
|
|
||||||
"extend[playlists]": "trackCount",
|
|
||||||
"include[songs]": "albums",
|
|
||||||
"fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount",
|
|
||||||
"limit[artists:top-songs]": 20,
|
|
||||||
"art[url]": "f"
|
|
||||||
}, {includeResponseMeta: !0}).then(artistData => {
|
|
||||||
artistData.data.forEach(item => {
|
|
||||||
if (item.views["latest-release"].data.length != 0) {
|
if (item.views["latest-release"].data.length != 0) {
|
||||||
self.artistFeed.push(item.views["latest-release"].data[0])
|
self.artistFeed.push(item.views["latest-release"].data[0])
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,8 +171,8 @@
|
||||||
let friends = badges[id]
|
let friends = badges[id]
|
||||||
if (friends) {
|
if (friends) {
|
||||||
friends.forEach(function (friend) {
|
friends.forEach(function (friend) {
|
||||||
self.app.mk.api.socialProfile(friend).then(data => {
|
self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
|
||||||
self.itemBadges.push(data)
|
self.itemBadges.push(data.data.data[0])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
"relate": "library"
|
"relate": "library"
|
||||||
};
|
};
|
||||||
const res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
const res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
||||||
this.inLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
|
this.inLibrary = (res.data.data[0] && res.data.data[0].attributes && res.data.data[0].attributes.inLibrary) ? res.data.data[0].attributes.inLibrary : false
|
||||||
console.log(res)
|
console.log(res)
|
||||||
} else {
|
} else {
|
||||||
this.inLibrary = true
|
this.inLibrary = true
|
||||||
|
@ -229,12 +229,16 @@
|
||||||
const params = {"fields[somgs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library"};
|
const params = {"fields[somgs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library"};
|
||||||
var id = this.data.id ?? this.data.attributes.playParams.id
|
var id = this.data.id ?? this.data.attributes.playParams.id
|
||||||
const res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
const res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
||||||
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
if (res.data.data[0] && res.data.data[0].relationships && res.data.data[0].relationships.library && res.data.data[0].relationships.library.data && res.data.data[0].relationships.library.data.length > 0) {
|
||||||
id = res.relationships.library.data[0].id
|
id = res.data.data[0].relationships.library.data[0].id
|
||||||
}
|
}
|
||||||
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.library.remove({[truekind]: id})
|
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "DELETE"
|
||||||
|
}})
|
||||||
this.inLibrary = false
|
this.inLibrary = false
|
||||||
this.confirm = false
|
this.confirm = false
|
||||||
},
|
},
|
||||||
|
@ -274,7 +278,19 @@
|
||||||
if (!this.data.attributes.canEdit) {
|
if (!this.data.attributes.canEdit) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await app.mk.api.library.putPlaylistTracklisting(this.data.attributes.playParams.id, this.convert())
|
console.log('sds',this.convert())
|
||||||
|
await app.mk.api.v3.music(
|
||||||
|
`/v1/me/library/playlists/${this.data.attributes.playParams.id}/tracks`,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
fetchOptions: {
|
||||||
|
method: "PUT",
|
||||||
|
body: JSON.stringify({
|
||||||
|
data: this.convert()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
},
|
},
|
||||||
async remove() {
|
async remove() {
|
||||||
if (!this.data.attributes.canEdit) {
|
if (!this.data.attributes.canEdit) {
|
||||||
|
|
|
@ -131,32 +131,22 @@
|
||||||
playlists.push(item.id)
|
playlists.push(item.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (playlists.length != 0) {
|
if (playlists.length != 0) {
|
||||||
this.app.mk.api.playlists(playlists).then(playlistsData => {
|
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${playlists.toString()}`).then(playlistsData => {
|
||||||
self.favorites.push(...playlistsData)
|
self.favorites.push(...playlistsData.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (libraryPlaylists.length != 0) {
|
if (libraryPlaylists.length != 0) {
|
||||||
this.app.mk.api.library.playlists(libraryPlaylists).then(playlistsData => {
|
this.app.mk.api.v3.music(`v1/me/library/playlists/${playlists.toString()}`).then(playlistsData => {
|
||||||
self.favorites.push(...playlistsData)
|
self.favorites.push(...playlistsData.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getArtistFeed() {
|
async getArtistFeed() {
|
||||||
let artists = this.followedArtists
|
let artists = this.followedArtists
|
||||||
let self = this
|
let self = this
|
||||||
this.app.mk.api.artists(artists, {
|
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${artists.toString()}&views=featured-release,full-albums,appears-on-albums,featured-albums,featured-on-albums,singles,compilation-albums,live-albums,latest-release,top-music-videos,similar-artists,top-songs,playlists,more-to-hear,more-to-see&extend=artistBio,bornOrFormed,editorialArtwork,editorialVideo,isGroup,origin,hero&extend[playlists]=trackCount&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=20&art[url]=f`).then(artistData => {
|
||||||
"views": "featured-release,full-albums,appears-on-albums,featured-albums,featured-on-albums,singles,compilation-albums,live-albums,latest-release,top-music-videos,similar-artists,top-songs,playlists,more-to-hear,more-to-see",
|
artistData.data.data.forEach(item => {
|
||||||
"extend": "artistBio,bornOrFormed,editorialArtwork,editorialVideo,isGroup,origin,hero",
|
|
||||||
"extend[playlists]": "trackCount",
|
|
||||||
"include[songs]": "albums",
|
|
||||||
"fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount",
|
|
||||||
"limit[artists:top-songs]": 20,
|
|
||||||
"art[url]": "f"
|
|
||||||
}, {
|
|
||||||
includeResponseMeta: !0
|
|
||||||
}).then(artistData => {
|
|
||||||
artistData.data.forEach(item => {
|
|
||||||
if (item.views["latest-release"].data.length != 0) {
|
if (item.views["latest-release"].data.length != 0) {
|
||||||
self.artistFeed.push(item.views["latest-release"].data[0])
|
self.artistFeed.push(item.views["latest-release"].data[0])
|
||||||
}
|
}
|
||||||
|
@ -176,35 +166,10 @@
|
||||||
},
|
},
|
||||||
async getListenNowData() {
|
async getListenNowData() {
|
||||||
let self = this
|
let self = this
|
||||||
this.app.mk.api.personalRecommendations("", {
|
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`).then((data) => {
|
||||||
name: "listen-now",
|
console.log(data.data.data[1])
|
||||||
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-profiles,social-upsells",
|
|
||||||
platform: "web"
|
|
||||||
}, {
|
|
||||||
includeResponseMeta: !0,
|
|
||||||
reload: !0
|
|
||||||
}).then((data) => {
|
|
||||||
console.log(data.data[1])
|
|
||||||
try {
|
try {
|
||||||
self.madeForYou = data.data.filter(section => {
|
self.madeForYou = data.data.data.filter(section => {
|
||||||
if (section.meta.metrics.moduleType == "6") {
|
if (section.meta.metrics.moduleType == "6") {
|
||||||
return section
|
return section
|
||||||
};
|
};
|
||||||
|
@ -213,8 +178,8 @@
|
||||||
self.sectionsReady.push("madeForYou")
|
self.sectionsReady.push("madeForYou")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
self.recentlyPlayed = data.data[1].relationships.contents.data
|
self.recentlyPlayed = data.data.data[1].relationships.contents.data
|
||||||
self.friendsListeningTo = data.data.filter(section => {
|
self.friendsListeningTo = data.data.data.filter(section => {
|
||||||
if (section.meta.metrics.moduleType == "11") {
|
if (section.meta.metrics.moduleType == "11") {
|
||||||
return section
|
return section
|
||||||
};
|
};
|
||||||
|
@ -228,7 +193,7 @@
|
||||||
self.profile = response.data.data[0]
|
self.profile = response.data.data[0]
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
|
@ -1,82 +1,97 @@
|
||||||
<script type="text/x-template" id="cider-search">
|
<script type="text/x-template" id="cider-search">
|
||||||
<div class="content-inner">
|
<div class="content-inner">
|
||||||
<div class="row">
|
<div v-if="search != null && search != [] && search.term != ''">
|
||||||
<div class="col-sm" style="width: auto;" v-if="getTopResult()">
|
<div class="row">
|
||||||
<template>
|
<div class="col-sm" style="width: auto;" v-if="getTopResult()">
|
||||||
<h3>Top Result</h3>
|
<template>
|
||||||
<mediaitem-square :item="getTopResult()"></mediaitem-square>
|
<h3>Top Result</h3>
|
||||||
</template>
|
<mediaitem-square :item="getTopResult()"></mediaitem-square>
|
||||||
</div>
|
</template>
|
||||||
<div class="col" v-if="search.results.song">
|
</div>
|
||||||
<div class="row">
|
<div class="col" v-if="search.results.song">
|
||||||
<div class="col">
|
<div class="row">
|
||||||
<h3>Songs</h3>
|
<div class="col">
|
||||||
|
<h3>Songs</h3>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto flex-center"
|
||||||
|
@click="app.showSearchView(app.search.term, 'song', app.friendlyTypes('song'))"
|
||||||
|
v-if="search.results.song.data.length >= 6">
|
||||||
|
<button class="cd-btn-seeall">See All</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto flex-center"
|
<div>
|
||||||
@click="app.showSearchView(app.search.term, 'song', app.friendlyTypes('song'))"
|
<mediaitem-list-item :item="item" :index="index"
|
||||||
v-if="search.results.song.data.length >= 6">
|
v-for="(item, index) in search.results.song.data.limit(6)"></mediaitem-list-item>
|
||||||
<button class="cd-btn-seeall">See All</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<mediaitem-list-item :item="item" :index="index"
|
|
||||||
v-for="(item, index) in search.results.song.data.limit(6)"></mediaitem-list-item>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<template v-if="search.results['meta']">
|
<template v-if="search.results['meta'] != null">
|
||||||
<template
|
<template
|
||||||
v-for="section in search.results.meta.results.order" v-if="section != 'song' && section != 'top'">
|
v-for="section in search.results.meta.results.order" v-if="section != 'song' && section != 'top'">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<h3>{{ app.friendlyTypes(section) }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto flex-center" v-if="search.results[section].data.length >= 10">
|
||||||
|
<button class="cd-btn-seeall"
|
||||||
|
@click="app.showSearchView(app.search.term, section, app.friendlyTypes(section))">See
|
||||||
|
All
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template v-if="!app.friendlyTypes(section).includes('Video')">
|
||||||
|
<mediaitem-scroller-horizontal-large
|
||||||
|
:items="search.results[section].data.limit(10)"></mediaitem-scroller-horizontal-large>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<mediaitem-scroller-horizontal-mvview
|
||||||
|
:items="search.results[section].data.limit(10)"></mediaitem-scroller-horizontal-mvview>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-if="search.resultsSocial.playlist">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>{{ app.friendlyTypes(section) }}</h3>
|
<h3>Shared Playlists</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto flex-center" v-if="search.results[section].data.length >= 10">
|
<div class="col-auto flex-center" v-if="search.resultsSocial.playlist.data.length >= 10">
|
||||||
<button class="cd-btn-seeall"
|
<button class="cd-btn-seeall"
|
||||||
@click="app.showSearchView(app.search.term, section, app.friendlyTypes(section))">See
|
@click="app.showCollection(search.resultsSocial.playlist, 'Shared Playlists', 'default')">See All
|
||||||
All
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="!app.friendlyTypes(section).includes('Video')">
|
<mediaitem-scroller-horizontal-large
|
||||||
<mediaitem-scroller-horizontal-large
|
:items="search.resultsSocial.playlist.data.limit(10)"></mediaitem-scroller-horizontal-large>
|
||||||
:items="search.results[section].data.limit(10)"></mediaitem-scroller-horizontal-large>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<mediaitem-scroller-horizontal-mvview
|
|
||||||
:items="search.results[section].data.limit(10)"></mediaitem-scroller-horizontal-mvview>
|
|
||||||
</template>
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
<template v-if="search.resultsSocial.profile">
|
||||||
<template v-if="search.resultsSocial.playlist">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col">
|
||||||
<div class="col">
|
<h3>People</h3>
|
||||||
<h3>Shared Playlists</h3>
|
</div>
|
||||||
|
<div class="col-auto flex-center" v-if="search.resultsSocial.profile.data.length >= 10">
|
||||||
|
<button class="cd-btn-seeall"
|
||||||
|
@click="app.showCollection(search.resultsSocial.profile, 'People', 'default')">See All
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto flex-center" v-if="search.resultsSocial.playlist.data.data.length >= 10">
|
<mediaitem-scroller-horizontal-large
|
||||||
<button class="cd-btn-seeall"
|
:items="search.resultsSocial.profile.data.limit(10)"></mediaitem-scroller-horizontal-large>
|
||||||
@click="app.showCollection(search.resultsSocial.playlist.data, 'Shared Playlists', 'default')">See All
|
</template>
|
||||||
</button>
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div v-if="categoriesReady || getCategories()">
|
||||||
|
<div>
|
||||||
|
<div class="col" v-if="categoriesView != null && categoriesView != [] && categoriesView[0].attributes != null && categoriesView[0].attributes.title != null">
|
||||||
|
<h3>{{categoriesView[0].attributes.title.stringForDisplay ?? ""}}</h3>
|
||||||
|
</div>
|
||||||
|
<mediaitem-square :kind="'385'" size="600"
|
||||||
|
:item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"
|
||||||
|
:imagesize="800"
|
||||||
|
v-for="item in categoriesView[1].relationships.contents.data.filter(item => item.type != 'editorial-items')">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<mediaitem-scroller-horizontal-large
|
</div>
|
||||||
:items="search.resultsSocial.playlist.data.data.limit(10)"></mediaitem-scroller-horizontal-large>
|
|
||||||
</template>
|
|
||||||
<template v-if="search.resultsSocial.profile">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<h3>People</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto flex-center" v-if="search.resultsSocial.profile.data.data.length >= 10">
|
|
||||||
<button class="cd-btn-seeall"
|
|
||||||
@click="app.showCollection(search.resultsSocial.profile.data, 'People', 'default')">See All
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<mediaitem-scroller-horizontal-large
|
|
||||||
:items="search.resultsSocial.profile.data.data.limit(10)"></mediaitem-scroller-horizontal-large>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -86,8 +101,10 @@
|
||||||
props: ['search'],
|
props: ['search'],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
app: this.$root
|
app: this.$root,
|
||||||
}
|
categoriesView : [],
|
||||||
|
categoriesReady : false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTopResult() {
|
getTopResult() {
|
||||||
|
@ -96,6 +113,13 @@
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
async getCategories() {
|
||||||
|
if(this.categoriesView != [] && this.categoriesView.length > 0) {this.categoriesReady = true; return await true;} else {
|
||||||
|
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`);
|
||||||
|
this.categoriesView = response.data.data;
|
||||||
|
this.categoriesReady = true;
|
||||||
|
return await true;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue