From 44a0e1801b55d4d02fcb7d4c1e28eee448dfab1a Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 27 Jul 2021 21:21:08 +0200 Subject: [PATCH] Started working on log formatting --- deemix/utils/index.js | 40 +++++++++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/deemix/utils/index.js b/deemix/utils/index.js index af65d86..22b7556 100644 --- a/deemix/utils/index.js +++ b/deemix/utils/index.js @@ -85,6 +85,43 @@ function removeDuplicateArtists(artist, artists){ return [artist, artists] } +function formatListener(key, data){ + let message = "" + switch (key) { + case "startAddingArtist": return `Started gathering ${data.name}'s albums (${data.id})` + case "finishAddingArtist": return `Finished gathering ${data.name}'s albums (${data.id})` + case "queueUpdate": + "bitrateFallback" + "searchFallback" + "downloaded" + "failed" + "progress" + "conversion" + return "" + case "downloadInfo": + "getTags" + "gotTags" + "getBitrate" + "gotBitrate" + "getAlbumArt" + "gotAlbumArt" + "downloading" + "downloaded" + "alreadyDownloaded" + "tagging" + "tagged" + return "" + case "downloadWarn": return "" + case "currentItemCancelled": return `Cancelled download of ${data}` + case "removedFromQueue": return `Removed ${data} from the queue` + case "finishDownload": return `${data} finished downloading` + case "startConversion": return `Started converting ${data}` + case "finishConversion": return `Finished converting ${data}` + default: return "" + + } +} + module.exports = { USER_AGENT_HEADER, generateReplayGainString, @@ -95,5 +132,6 @@ module.exports = { pipeline, canWrite, changeCase, - shellEscape + shellEscape, + formatListener } diff --git a/package.json b/package.json index c8c7b74..ae13138 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dependencies": { "async": "^3.2.0", "crypto": "^1.0.1", - "deezer-js": "^1.0.3", + "deezer-js": "^1.0.5", "got": "^11.8.2", "metaflac-js2": "^1.0.7", "spotify-web-api-node": "^5.0.2"