Playlist Downloads are now working
[DeezloaderRemix.git] / app / lib / deezer-api / obj / Track.js
index 65d4e90a1e98aa8c2cd4da47bcd933d48b22b957..f592f5e29709166bb744c7e0a2c42a47bfad06fb 100644 (file)
@@ -135,25 +135,29 @@ module.exports = class Track {
         this.id = body.SNG_ID
         this.title = `${body.SNG_TITLE}${body.VERSION ? ` ${body.VERSION}`: ""}`
         this.duration = body.DURATION
-        this.filesize = {
-          default: parseInt(body.FILESIZE),
-          mp3_128: parseInt(body.FILESIZE_MP3_128),
-          mp3_320: parseInt(body.FILESIZE_MP3_320),
-          flac: parseInt(body.FILESIZE_FLAC),
-        }
         this.MD5 = body.MD5_ORIGIN
         this.mediaVersion = body.MEDIA_VERSION
         this.fallbackId = (body.FALLBACK ? (body.FALLBACK.SNG_ID ? body.FALLBACK.SNG_ID : 0) : 0)
         this.album = {id: body.ALB_ID, title: body.ALB_TITLE, picture: body.ALB_PICTURE}
         this.artist = {id: body.ART_ID, name: body.ART_NAME, picture: body.ART_PICTURE}
         this.artistsString = []
-        if (body.SNG_CONTRIBUTORS.main_artist){
-          this.artistsString = this.artistsString.concat(body.SNG_CONTRIBUTORS.main_artist)
-        }else if (body.SNG_CONTRIBUTORS.mainartist){
-          this.artistsString = this.artistsString.concat(body.SNG_CONTRIBUTORS.mainartist)
-        }
-        if (body.SNG_CONTRIBUTORS.associatedperformer) {
-          this.artistsString = this.artistsString.concat(body.SNG_CONTRIBUTORS.associatedperformer)
+        if (parseInt(this.id) > 0){
+          this.filesize = {
+            default: parseInt(body.FILESIZE),
+            mp3_128: parseInt(body.FILESIZE_MP3_128),
+            mp3_320: parseInt(body.FILESIZE_MP3_320),
+            flac: parseInt(body.FILESIZE_FLAC),
+          }
+          if (body.SNG_CONTRIBUTORS.main_artist){
+            this.artistsString = this.artistsString.concat(body.SNG_CONTRIBUTORS.main_artist)
+          }else if (body.SNG_CONTRIBUTORS.mainartist){
+            this.artistsString = this.artistsString.concat(body.SNG_CONTRIBUTORS.mainartist)
+          }
+          if (body.SNG_CONTRIBUTORS.associatedperformer) {
+            this.artistsString = this.artistsString.concat(body.SNG_CONTRIBUTORS.associatedperformer)
+          }
+        }else{
+          this.filesize = body.FILESIZE
         }
         if (!this.artistsString[0]) this.artistsString.push(this.artist.name)
         this.gain = body.GAIN