From 08ae889a09712b90debd60d30fad544a1dd6aa47 Mon Sep 17 00:00:00 2001 From: kermit Date: Mon, 2 Aug 2021 16:31:17 +0100 Subject: [PATCH] Expose extrasPath to REST API --- deemix/downloader.js | 16 +++++++++++++--- deemix/types/DownloadObjects.js | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/deemix/downloader.js b/deemix/downloader.js index f55d192..76394d2 100644 --- a/deemix/downloader.js +++ b/deemix/downloader.js @@ -355,7 +355,10 @@ class Downloader { let writepath = `${filepath}/${filename}${extension}` // Save extrasPath - if (extrasPath && !this.extrasPath) this.extrasPath = extrasPath + if (extrasPath && !this.extrasPath) { + this.extrasPath = extrasPath + this.downloadObject.extrasPath = extrasPath + } // Generate covers URLs let embeddedImageFormat = `jpg-${this.settings.jpegImageQuality}` @@ -595,7 +598,10 @@ class Downloader { async afterDownloadSingle(track){ if (!track) return - if (!this.extrasPath) this.extrasPath = this.settings.downloadLocation + if (!this.extrasPath) { + this.extrasPath = this.settings.downloadLocation + this.downloadObject.extrasPath = this.extrasPath + } // Save local album artwork if (this.settings.saveArtwork && track.albumPath) @@ -626,7 +632,11 @@ class Downloader { } async afterDownloadCollection(tracks){ - if (!this.extrasPath) this.extrasPath = this.settings.downloadLocation + if (!this.extrasPath) { + this.extrasPath = this.settings.downloadLocation + this.downloadObject.extrasPath = this.extrasPath + } + let playlist = [] let errors = "" let searched = "" diff --git a/deemix/types/DownloadObjects.js b/deemix/types/DownloadObjects.js index 5055dcf..5b8fa8b 100644 --- a/deemix/types/DownloadObjects.js +++ b/deemix/types/DownloadObjects.js @@ -34,6 +34,7 @@ class IDownloadObject{ failed: this.failed, progress: this.progress, errors: this.errors, + extrasPath: this.extrasPath, files: this.files, __type__: this.__type__ } @@ -70,7 +71,8 @@ class IDownloadObject{ artist: this.artist, cover: this.cover, explicit: this.explicit, - size: this.size + size: this.size, + extrasPath: this.extrasPath } }