mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-29 10:56:18 +00:00
Fixed minor issues
This commit is contained in:
parent
e97dad3873
commit
155aaf126f
|
@ -45,7 +45,7 @@ async function parseLink(link){
|
|||
return [link, link_type, link_id]
|
||||
}
|
||||
|
||||
async function generateDownloadObject(dz, link, bitrate){
|
||||
async function generateDownloadObject(dz, link, bitrate, plugins={}, listener){
|
||||
let link_type, link_id
|
||||
[link, link_type, link_id] = await parseLink(link)
|
||||
|
||||
|
@ -59,9 +59,9 @@ async function generateDownloadObject(dz, link, bitrate){
|
|||
case 'playlist':
|
||||
return generatePlaylistItem(dz, link_id, bitrate)
|
||||
case 'artist':
|
||||
return generateArtistItem(dz, link_id, bitrate)
|
||||
return generateArtistItem(dz, link_id, bitrate, listener)
|
||||
case 'artist_discography':
|
||||
return generateArtistDiscographyItem(dz, link_id, bitrate)
|
||||
return generateArtistDiscographyItem(dz, link_id, bitrate, listener)
|
||||
case 'artist_top':
|
||||
return generateArtistTopItem(dz, link_id, bitrate)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ const { map_user_playlist } = require('deezer-js').utils
|
|||
|
||||
async function generateTrackItem(dz, id, bitrate, trackAPI, albumAPI){
|
||||
// Check if is an isrc: url
|
||||
if (id.startsWith("isrc")){
|
||||
if (String(id).startsWith("isrc")){
|
||||
try {
|
||||
trackAPI = await dz.api.get_track(id)
|
||||
} catch (e){
|
||||
|
@ -63,7 +63,7 @@ async function generateAlbumItem(dz, id, bitrate, rootArtist){
|
|||
throw new GenerationError(e)
|
||||
}
|
||||
|
||||
if (id.startsWith('upc')) { id = albumAPI['id'] }
|
||||
if (String(id).startsWith('upc')) { id = albumAPI['id'] }
|
||||
|
||||
// Get extra info about album
|
||||
// This saves extra api calls when downloading
|
||||
|
@ -188,12 +188,12 @@ async function generateArtistItem(dz, id, bitrate, listener){
|
|||
if (listener) { listener.send("startAddingArtist", rootArtist) }
|
||||
|
||||
const artistDiscographyAPI = await dz.gw.get_artist_discography_tabs(id, 100)
|
||||
const allReleases = artistDiscographyAPI.pop('all', [])
|
||||
const allReleases = artistDiscographyAPI.all || []
|
||||
let albumList = []
|
||||
allReleases.forEach(async (album) => {
|
||||
try{
|
||||
let albumData = await generateAlbumItem(dz, album.id, bitrate, rootArtist)
|
||||
albumList.append(albumData)
|
||||
albumList.push(albumData)
|
||||
}catch (e){
|
||||
console.warn(album.id, "No Data", e)
|
||||
}
|
||||
|
@ -220,13 +220,13 @@ async function generateArtistDiscographyItem(dz, id, bitrate, listener){
|
|||
if (listener) { listener.send("startAddingArtist", rootArtist) }
|
||||
|
||||
let artistDiscographyAPI = await dz.gw.get_artist_discography_tabs(id, 100)
|
||||
artistDiscographyAPI.pop('all', null)
|
||||
delete artistDiscographyAPI.all
|
||||
let albumList = []
|
||||
artistDiscographyAPI.forEach((type) => {
|
||||
type.forEach(async (album) => {
|
||||
try{
|
||||
let albumData = await generateAlbumItem(dz, album.id, bitrate, rootArtist)
|
||||
albumList.append(albumData)
|
||||
albumList.push(albumData)
|
||||
}catch (e){
|
||||
console.warn(album.id, "No Data", e)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class IDownloadObject{
|
|||
|
||||
getSlimmedDict(){
|
||||
let light = this.toDict()
|
||||
let propertiesToDelete = ['single', 'collection', 'convertable']
|
||||
let propertiesToDelete = ['single', 'collection', 'plugin', 'conversion_data']
|
||||
propertiesToDelete.forEach((property) => {
|
||||
if (Object.keys(light).includes(property)){
|
||||
delete light[property]
|
||||
|
|
Loading…
Reference in a new issue