Small Patch
This commit is contained in:
parent
f8f4d88008
commit
283eabd3c9
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "play-dl",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "play-dl",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"got": "^11.8.2"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "play-dl",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.3",
|
||||
"description": "YouTube, SoundCloud, Spotify streaming for discord.js bots",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
|
||||
@ -77,6 +77,9 @@ export class LiveStreaming{
|
||||
this.packet_count++
|
||||
resolve('')
|
||||
})
|
||||
stream.once('error', (err) => {
|
||||
this.stream.emit('error', err)
|
||||
})
|
||||
})
|
||||
})()
|
||||
}
|
||||
@ -151,6 +154,9 @@ export class LiveEnded{
|
||||
this.packet_count++
|
||||
resolve('')
|
||||
})
|
||||
stream.once('error', (err) => {
|
||||
this.stream.emit('error', err)
|
||||
})
|
||||
})
|
||||
})()
|
||||
}
|
||||
@ -198,6 +204,11 @@ export class Stream {
|
||||
}
|
||||
let stream = got.stream(this.url)
|
||||
this.request = stream
|
||||
|
||||
stream.once('error', (err) => {
|
||||
this.stream.emit('error', err)
|
||||
})
|
||||
|
||||
stream.pipe(this.stream)
|
||||
}
|
||||
|
||||
@ -212,6 +223,10 @@ export class Stream {
|
||||
this.per_sec_bytes = Math.ceil((stream.downloadProgress.total as number)/this.duration)
|
||||
})
|
||||
|
||||
stream.once('error', (err) => {
|
||||
this.stream.emit('error', err)
|
||||
})
|
||||
|
||||
stream.on('data', (chunk: any) => {
|
||||
this.bytes_count += chunk.length
|
||||
this.stream.write(chunk)
|
||||
@ -244,6 +259,11 @@ export class Stream {
|
||||
this.bytes_count += chunk.length
|
||||
this.stream.write(chunk)
|
||||
})
|
||||
|
||||
stream.once('error', (err) => {
|
||||
this.stream.emit('error', err)
|
||||
})
|
||||
|
||||
stream.on('data', () => {
|
||||
if(absolute_bytes > (this.per_sec_bytes * 300)){
|
||||
stream.destroy()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user