Merge branch 'master' into captcha-login
[DeezloaderRemix.git] / app / app.js
index 32ddf4ad5fc9f74e95b933ef7a88629f3544e813..e2cd1c408d7ed027f4d1d309edf6fac1307977de 100644 (file)
@@ -109,7 +109,9 @@ io.sockets.on('connection', function (s) {
                        lastVersion_MAJOR==currentVersion_MAJOR && lastVersion_MINOR==currentVersion_MINOR && lastVersion_PATCH>currentVersion_PATCH
                ){
                        logger.info("Update Available")
-                       s.emit("message", {title: `Version ${lastVersion_MAJOR}.${lastVersion_MINOR}.${lastVersion_PATCH} is available!`, msg: body.changelog})
+                       s.emit("messageUpdate", {title: `Version ${lastVersion_MAJOR}.${lastVersion_MINOR}.${lastVersion_PATCH} is available!`, msg: body.changelog, lastVersion: body.version})
+               }else{
+                       logger.info("Running the latest version!")
                }
        })
        .catch(error=>{
@@ -1263,9 +1265,9 @@ io.sockets.on('connection', function (s) {
                        // Acquiring bpm (only if necessary)
                        if (settings.tags.bpm){
                                logger.info(`[${track.artist.name} - ${track.title}] Getting BPM`);
+                               track.legacyTrack = await s.Deezer.legacyGetTrack(track.id)
                                try{
-                                       var bpm = await s.Deezer.legacyGetTrack(track.id)
-                                       track.bpm = bpm.bpm
+                                       track.bpm = track.legacyTrack.bpm
                                }catch(err){
                                        track.bpm = 0
                                }
@@ -1276,8 +1278,8 @@ io.sockets.on('connection', function (s) {
                        // Acquiring ReplayGain value (only if necessary)
                        if (settings.tags.replayGain){
                                logger.info(`[${track.artist.name} - ${track.title}] Getting track gain`);
+                               if (!track.legacyTrack) track.legacyTrack = await s.Deezer.legacyGetTrack(track.id)
                                try{
-                                       var gain = await s.Deezer.legacyGetTrack(track.id)
                                        track.replayGain = gain.gain
                                }catch(err){
                                        track.replayGain = 0
@@ -1286,10 +1288,11 @@ io.sockets.on('connection', function (s) {
                                track.replayGain = 0
                        }
 
+                       // Acquiring discNumber value (only if necessary)
                        if (settings.tags.discNumber && !track.discNumber){
                                logger.info(`[${track.artist.name} - ${track.title}] Getting disc number`);
-                               var discNumber = await s.Deezer.legacyGetTrack(track.id)
-                               track.discNumber = discNumber.disk_number
+                               if (!track.legacyTrack) track.legacyTrack = await s.Deezer.legacyGetTrack(track.id)
+                               track.discNumber = track.legacyTrack.disk_number
                        }
 
                        let separator = settings.multitagSeparator
@@ -1413,7 +1416,10 @@ io.sockets.on('connection', function (s) {
                                if (!(track.selectedFormat == 9 && separator==String.fromCharCode(parseInt("\u0000",16)))) track.artistsString = track.artistsString.join(separator)
                        }
                        if (track.genre){
-                               if (!(track.selectedFormat == 9 && separator==String.fromCharCode(parseInt("\u0000",16)))) track.genreString = track.genre.join(separator)
+                               if (!(track.selectedFormat == 9 && separator==String.fromCharCode(parseInt("\u0000",16))))
+                                       track.genreString = track.genre.join(separator)
+                               else
+                                       track.genreString = track.genre
                        }
 
                        if (track.date){