Add socket event to remove download, fix clearInterval on stream loop

This commit is contained in:
advplyr 2021-09-12 16:10:12 -05:00
parent c30955f909
commit 9107620b3c
5 changed files with 26 additions and 3 deletions

View file

@ -43,6 +43,10 @@ class Stream extends EventEmitter {
return this.audiobook.id
}
get audiobookTitle() {
return this.audiobook ? this.audiobook.title : null
}
get totalDuration() {
return this.audiobook.totalDuration
}
@ -206,8 +210,9 @@ class Stream extends EventEmitter {
if (!this.isTranscodeComplete) {
this.checkFiles()
} else {
Logger.info(`[Stream] ${this.audiobookTitle} sending stream_ready`)
this.socket.emit('stream_ready')
clearTimeout(this.loop)
clearInterval(this.loop)
}
}, 2000)
}