improve getting the artist/album from item
This commit is contained in:
parent
cbb6824ff4
commit
bd8cbb5921
1 changed files with 14 additions and 5 deletions
|
@ -858,11 +858,12 @@ const app = new Vue({
|
||||||
case "artist":
|
case "artist":
|
||||||
let artistId = '';
|
let artistId = '';
|
||||||
try {
|
try {
|
||||||
if (item.relationships.artists && item.relationships.artists.data.length > 0) {
|
if (item.relationships.artists && item.relationships.artists.data.length > 0 && !item.relationships.artists.data[0].type.includes("library")) {
|
||||||
if (item.relationships.artists.data[0].type === "artist" || item.relationships.artists.data[0].type === "artists") {
|
if (item.relationships.artists.data[0].type === "artist" || item.relationships.artists.data[0].type === "artists" ) {
|
||||||
artistId = item.relationships.artists.data[0].id
|
artistId = item.relationships.artists.data[0].id
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (artistId == '') {
|
||||||
const url = (item.relationships.catalog.data[0].attributes.artistUrl);
|
const url = (item.relationships.catalog.data[0].attributes.artistUrl);
|
||||||
artistId = (url).substring(url.lastIndexOf('/') + 1)
|
artistId = (url).substring(url.lastIndexOf('/') + 1)
|
||||||
if (artistId.includes('viewCollaboration')) {
|
if (artistId.includes('viewCollaboration')) {
|
||||||
|
@ -892,11 +893,18 @@ const app = new Vue({
|
||||||
case "album":
|
case "album":
|
||||||
let albumId = '';
|
let albumId = '';
|
||||||
try {
|
try {
|
||||||
if (item.relationships.albums && item.relationships.albums.data.length > 0) {
|
if (item.relationships.albums && item.relationships.albums.data.length > 0 && !item.relationships.albums.data[0].type.includes("library")) {
|
||||||
if (item.relationships.albums.data[0].type === "album" || item.relationships.albums.data[0].type === "albums") {
|
if (item.relationships.albums.data[0].type === "album" || item.relationships.albums.data[0].type === "albums") {
|
||||||
albumId = item.relationships.albums.data[0].id
|
albumId = item.relationships.albums.data[0].id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (albumId == '') {
|
||||||
|
const url = (item.relationships.catalog.data[0].attributes.url);
|
||||||
|
albumId = (url).substring(url.lastIndexOf('/') + 1)
|
||||||
|
if (albumId.includes("?i=")) {
|
||||||
|
albumId = albumId.substring(0, albumId.indexOf("?i="))
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,10 +1209,11 @@ const app = new Vue({
|
||||||
|
|
||||||
function downloadChunk() {
|
function downloadChunk() {
|
||||||
const params = {
|
const params = {
|
||||||
"include[library-songs]": "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: "web",
|
platform: "web",
|
||||||
|
"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,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue