Started working on log formatting

This commit is contained in:
RemixDev 2021-07-27 21:21:08 +02:00
parent 705987b597
commit 44a0e1801b
2 changed files with 40 additions and 2 deletions

View file

@ -85,6 +85,43 @@ function removeDuplicateArtists(artist, artists){
return [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 = { module.exports = {
USER_AGENT_HEADER, USER_AGENT_HEADER,
generateReplayGainString, generateReplayGainString,
@ -95,5 +132,6 @@ module.exports = {
pipeline, pipeline,
canWrite, canWrite,
changeCase, changeCase,
shellEscape shellEscape,
formatListener
} }

View file

@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"async": "^3.2.0", "async": "^3.2.0",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"deezer-js": "^1.0.3", "deezer-js": "^1.0.5",
"got": "^11.8.2", "got": "^11.8.2",
"metaflac-js2": "^1.0.7", "metaflac-js2": "^1.0.7",
"spotify-web-api-node": "^5.0.2" "spotify-web-api-node": "^5.0.2"