From 155aaf126f4cea6c94f89121f35daec5aec71d28 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 13 May 2021 18:11:56 +0200 Subject: [PATCH] Fixed minor issues --- deemix/index.js | 6 +++--- deemix/itemgen.js | 12 ++++++------ deemix/types/DownloadObjects.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/deemix/index.js b/deemix/index.js index f133a67..aed69fe 100644 --- a/deemix/index.js +++ b/deemix/index.js @@ -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) } diff --git a/deemix/itemgen.js b/deemix/itemgen.js index acbcde8..5dea1f5 100644 --- a/deemix/itemgen.js +++ b/deemix/itemgen.js @@ -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) } diff --git a/deemix/types/DownloadObjects.js b/deemix/types/DownloadObjects.js index f0f9091..deadc79 100644 --- a/deemix/types/DownloadObjects.js +++ b/deemix/types/DownloadObjects.js @@ -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]