From ff66368da16c513ff93d6f4c41610e556eec95cb Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Wed, 13 Oct 2021 19:15:40 +0530 Subject: [PATCH 1/2] Spotify Fix --- play-dl/Spotify/classes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/play-dl/Spotify/classes.ts b/play-dl/Spotify/classes.ts index 2e5148b..e0643f7 100644 --- a/play-dl/Spotify/classes.ts +++ b/play-dl/Spotify/classes.ts @@ -148,7 +148,7 @@ export class SpotifyPlaylist { if (typeof response !== 'string') return; const json_data = JSON.parse(response); json_data.items.forEach((v: any) => { - videos.push(new SpotifyTrack(v.track)); + if(v.track) videos.push(new SpotifyTrack(v.track)); }); this.fetched_tracks.set(`${i}`, videos); resolve('Success'); @@ -254,7 +254,7 @@ export class SpotifyAlbum { if (typeof response !== 'string') return; const json_data = JSON.parse(response); json_data.items.forEach((v: any) => { - videos.push(new SpotifyTrack(v)); + if(v) videos.push(new SpotifyTrack(v)); }); this.fetched_tracks.set(`${i}`, videos); resolve('Success'); From ba31d26b0764650544019be8c1004f7896e2f594 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Wed, 13 Oct 2021 20:51:33 +0530 Subject: [PATCH 2/2] SoundCloud durationInSec fixed --- play-dl/SoundCloud/classes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/play-dl/SoundCloud/classes.ts b/play-dl/SoundCloud/classes.ts index 3356957..c7278f7 100644 --- a/play-dl/SoundCloud/classes.ts +++ b/play-dl/SoundCloud/classes.ts @@ -60,7 +60,7 @@ export class SoundCloudTrack { this.url = data.uri; this.fetched = true; this.type = 'track'; - this.durationInSec = Number(data.duration) / 1000; + this.durationInSec = Math.round(Number(data.duration) / 1000); this.durationInMs = Number(data.duration); if (data.publisher_metadata) this.publisher = { @@ -125,7 +125,7 @@ export class SoundCloudPlaylist { this.client_id = client_id; this.type = 'playlist'; this.sub_type = data.set_type; - this.durationInSec = Number(data.duration) / 1000; + this.durationInSec = Math.round(Number(data.duration) / 1000); this.durationInMs = Number(data.duration); this.user = { name: data.user.username,