From 56a0cd63745cd46fe1fa86d047e11f761d3dbaab Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Fri, 14 May 2021 06:19:42 +0545 Subject: [PATCH] bump ytdl-core --- package.json | 2 +- src/Player.ts | 10 +++++++--- yarn.lock | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 4737441..93cc9aa 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "soundcloud-scraper": "^5.0.0", "spotify-url-info": "^2.2.0", "youtube-sr": "^4.0.7", - "ytdl-core": "^4.7.0" + "ytdl-core": "^4.8.0" }, "devDependencies": { "@babel/cli": "^7.13.16", diff --git a/src/Player.ts b/src/Player.ts index 97837d3..3058f93 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -326,12 +326,13 @@ export class Player extends EventEmitter { const queue = this._addTracksToQueue(message, tracks); this.emit(PlayerEvents.PLAYLIST_ADD, message, queue, pl); } else { - const track = tracks.shift(); + const track = tracks[0]; const queue = (await this._createQueue(message, track).catch( (e) => void this.emit(PlayerEvents.ERROR, e, message) )) as Queue; this.emit(PlayerEvents.PLAYLIST_ADD, message, queue, pl); this.emit(PlayerEvents.TRACK_START, message, queue.tracks[0], queue); + tracks.shift(); this._addTracksToQueue(message, tracks); } @@ -382,12 +383,13 @@ export class Player extends EventEmitter { const queue = this._addTracksToQueue(message, tracks); this.emit(PlayerEvents.PLAYLIST_ADD, message, queue, playlist); } else { - const track = tracks.shift(); + const track = tracks[0]; const queue = (await this._createQueue(message, track).catch( (e) => void this.emit(PlayerEvents.ERROR, e, message) )) as Queue; this.emit(PlayerEvents.PLAYLIST_ADD, message, queue, playlist); this.emit(PlayerEvents.TRACK_START, message, queue.tracks[0], queue); + tracks[0]; this._addTracksToQueue(message, tracks); } @@ -437,12 +439,13 @@ export class Player extends EventEmitter { const queue = this._addTracksToQueue(message, res.tracks); this.emit(PlayerEvents.PLAYLIST_ADD, message, queue, res); } else { - const track = res.tracks.shift(); + const track = res.tracks[0]; const queue = (await this._createQueue(message, track).catch( (e) => void this.emit(PlayerEvents.ERROR, e, message) )) as Queue; this.emit(PlayerEvents.PLAYLIST_ADD, message, queue, res); this.emit(PlayerEvents.TRACK_START, message, queue.tracks[0], queue); + res.tracks.shift(); this._addTracksToQueue(message, res.tracks); } @@ -1549,6 +1552,7 @@ export default Player; * The type of Track source, either: * * `soundcloud` - a stream from SoundCloud * * `youtube` - a stream from YouTube + * * `spotify` - a spotify track * * `arbitrary` - arbitrary stream * @typedef {String} TrackSource */ diff --git a/yarn.lock b/yarn.lock index 24d141b..702661d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4642,10 +4642,10 @@ youtube-sr@^4.0.7: "@types/node-fetch" "^2.5.10" node-fetch "^2.6.1" -ytdl-core@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-4.7.0.tgz#2c92023536484d8a2760d1aa504df2778f87ae21" - integrity sha512-G09HeYsyLMsUCPEuK2asDqmLnOx+n5SxVV3QqGJd+iYuw5Z/qiwx7x0gxZTiAkHBsbG3WuluJWBPswZyrygKmQ== +ytdl-core@^4.8.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-4.8.0.tgz#d9f037a370a4b984f1f937e7a11b4531e8959443" + integrity sha512-LFhhwqFojReoaME17VpsFeiamygM0W/YNG8O02mrmS2O6Em5LjCPiJYdq7Af3CmJtBEOCdptSZ3Ql+3LGWDGvg== dependencies: m3u8stream "^0.8.3" miniget "^4.0.0"