Fixed #235
authorRemixDev <deezloaderremix@gmail.com>
Wed, 13 Mar 2019 22:07:11 +0000 (23:07 +0100)
committerRemixDev <deezloaderremix@gmail.com>
Wed, 13 Mar 2019 22:07:11 +0000 (23:07 +0100)
app/app.js

index 4312fa54a5feffbe72fb9d7f31840e1f6f07d5b5..acfa7ba298a0de97e3ed579bc5e544740a559613 100644 (file)
@@ -1319,6 +1319,34 @@ io.sockets.on('connection', function (s) {
                        if (!track.album.artist.picture) track.album.artist.picture = ""
                        track.album.artist.pictureUrl = `${s.Deezer.artistPictureHost}${track.album.artist.picture}/${settings.artworkSize}x${settings.artworkSize}-000000-80-0-0${(settings.PNGcovers ? ".png" : ".jpg")}`
                        track.album.pictureUrl = `${s.Deezer.albumPicturesHost}${track.album.picture}/${settings.artworkSize}x${settings.artworkSize}-000000-80-0-0${(settings.PNGcovers ? ".png" : ".jpg")}`
+
+                       // Auto detect aviable track format from settings
+                       if (parseInt(track.id)>0){
+                               switch(downloadQueue[queueId].bitrate.toString()){
+                                       case "9":
+                                               track.selectedFormat = 9
+                                               track.selectedFilesize = track.filesize.flac
+                                               if (track.filesize.flac>0) break
+                                               if (!settings.fallbackBitrate) throw new Error("Song not found at desired bitrate.")
+                                       case "3":
+                                               track.selectedFormat = 3
+                                               track.selectedFilesize = track.filesize.mp3_320
+                                               if (track.filesize.mp3_320>0) break
+                                               if (!settings.fallbackBitrate) throw new Error("Song not found at desired bitrate.")
+                                       case "1":
+                                               track.selectedFormat = 1
+                                               track.selectedFilesize = track.filesize.mp3_128
+                                               if (track.filesize.mp3_128>0) break
+                                               if (!settings.fallbackBitrate) throw new Error("Song not found at desired bitrate.")
+                                       default:
+                                               track.selectedFormat = 8
+                                               track.selectedFilesize = track.filesize.default
+                               }
+                       }else{
+                               track.selectedFilesize = track.filesize
+                               track.selectedFormat = 3
+                       }
+
                        if(track.contributor){
                                if(track.contributor.composer){
                                        track.composerString = []
@@ -1399,33 +1427,6 @@ io.sockets.on('connection', function (s) {
                        track.date = {year: 0,day: 0,month: 0}
                }
 
-               // Auto detect aviable track format from settings
-               if (parseInt(track.id)>0){
-                       switch(downloadQueue[queueId].bitrate){
-                               case "9":
-                                       track.selectedFormat = 9
-                                       track.selectedFilesize = track.filesize.flac
-                                       if (track.filesize.flac>0) break
-                                       if (!settings.fallbackBitrate) throw new Error("Song not found at desired bitrate.")
-                               case "3":
-                                       track.selectedFormat = 3
-                                       track.selectedFilesize = track.filesize.mp3_320
-                                       if (track.filesize.mp3_320>0) break
-                                       if (!settings.fallbackBitrate) throw new Error("Song not found at desired bitrate.")
-                               case "1":
-                                       track.selectedFormat = 1
-                                       track.selectedFilesize = track.filesize.mp3_128
-                                       if (track.filesize.mp3_128>0) break
-                                       if (!settings.fallbackBitrate) throw new Error("Song not found at desired bitrate.")
-                               default:
-                                       track.selectedFormat = 8
-                                       track.selectedFilesize = track.filesize.default
-                       }
-               }else{
-                       track.selectedFilesize = track.filesize
-                       track.selectedFormat = 3
-               }
-
                // TODO: Move to a separate function
                // Generating file name
                if (settings.saveFullArtists && settings.multitagSeparator != null){