mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2025-01-01 12:25:59 +00:00
Fixed artist downloadItem generation
This commit is contained in:
parent
8726f81f0c
commit
a6f50289df
|
@ -4,6 +4,7 @@ const {
|
||||||
} = require('./types/DownloadObjects.js')
|
} = require('./types/DownloadObjects.js')
|
||||||
const { LyricsStatus } = require('deezer-js').gw
|
const { LyricsStatus } = require('deezer-js').gw
|
||||||
const { map_user_playlist } = require('deezer-js').utils
|
const { map_user_playlist } = require('deezer-js').utils
|
||||||
|
const { each } = require('async')
|
||||||
|
|
||||||
async function generateTrackItem(dz, id, bitrate, trackAPI, albumAPI){
|
async function generateTrackItem(dz, id, bitrate, trackAPI, albumAPI){
|
||||||
// Check if is an isrc: url
|
// Check if is an isrc: url
|
||||||
|
@ -183,14 +184,15 @@ async function generateArtistItem(dz, id, bitrate, listener){
|
||||||
|
|
||||||
const rootArtist = {
|
const rootArtist = {
|
||||||
id: artistAPI.id,
|
id: artistAPI.id,
|
||||||
name: artistAPI.name
|
name: artistAPI.name,
|
||||||
|
picture_small: artistAPI.picture_small
|
||||||
}
|
}
|
||||||
if (listener) { listener.send("startAddingArtist", rootArtist) }
|
if (listener) { listener.send("startAddingArtist", rootArtist) }
|
||||||
|
|
||||||
const artistDiscographyAPI = await dz.gw.get_artist_discography_tabs(id, 100)
|
const artistDiscographyAPI = await dz.gw.get_artist_discography_tabs(id, 100)
|
||||||
const allReleases = artistDiscographyAPI.all || []
|
const allReleases = artistDiscographyAPI.all || []
|
||||||
let albumList = []
|
let albumList = []
|
||||||
allReleases.forEach(async (album) => {
|
await each(allReleases, async (album) =>{
|
||||||
try{
|
try{
|
||||||
let albumData = await generateAlbumItem(dz, album.id, bitrate, rootArtist)
|
let albumData = await generateAlbumItem(dz, album.id, bitrate, rootArtist)
|
||||||
albumList.push(albumData)
|
albumList.push(albumData)
|
||||||
|
@ -215,15 +217,16 @@ async function generateArtistDiscographyItem(dz, id, bitrate, listener){
|
||||||
|
|
||||||
const rootArtist = {
|
const rootArtist = {
|
||||||
id: artistAPI.id,
|
id: artistAPI.id,
|
||||||
name: artistAPI.name
|
name: artistAPI.name,
|
||||||
|
picture_small: artistAPI.picture_small
|
||||||
}
|
}
|
||||||
if (listener) { listener.send("startAddingArtist", rootArtist) }
|
if (listener) { listener.send("startAddingArtist", rootArtist) }
|
||||||
|
|
||||||
let artistDiscographyAPI = await dz.gw.get_artist_discography_tabs(id, 100)
|
let artistDiscographyAPI = await dz.gw.get_artist_discography_tabs(id, 100)
|
||||||
delete artistDiscographyAPI.all
|
delete artistDiscographyAPI.all
|
||||||
let albumList = []
|
let albumList = []
|
||||||
artistDiscographyAPI.forEach((type) => {
|
await each(artistDiscographyAPI, async(type) => {
|
||||||
type.forEach(async (album) => {
|
await each(type, async (album) =>{
|
||||||
try{
|
try{
|
||||||
let albumData = await generateAlbumItem(dz, album.id, bitrate, rootArtist)
|
let albumData = await generateAlbumItem(dz, album.id, bitrate, rootArtist)
|
||||||
albumList.push(albumData)
|
albumList.push(albumData)
|
||||||
|
|
Loading…
Reference in a new issue