mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-12 21:40:21 +00:00
fix: subtitle parsing
This commit is contained in:
parent
5cf2a5d876
commit
7967ad51f4
2 changed files with 6 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "4.0.5",
|
||||
"version": "4.0.6",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
"main": "build/main.js",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ class TorrentClient extends WebTorrent {
|
|||
|
||||
this.current = null
|
||||
this.parsed = false
|
||||
this.parserInstance = null
|
||||
this.boundParse = this.parseSubtitles.bind(this)
|
||||
|
||||
setInterval(() => {
|
||||
|
|
@ -54,9 +53,8 @@ class TorrentClient extends WebTorrent {
|
|||
case 'current': {
|
||||
this.current?.removeListener('done', this.boundParse)
|
||||
this.cancelParse()
|
||||
this.parserInstance?.destroy()
|
||||
this.parserInstance = null
|
||||
this.current = null
|
||||
this.metadata = null
|
||||
this.parsed = false
|
||||
if (data.data) {
|
||||
this.current = (await this.get(data.data.infoHash))?.files.find(file => file.path === data.data.path)
|
||||
|
|
@ -66,9 +64,9 @@ class TorrentClient extends WebTorrent {
|
|||
this.parseFonts(this.current)
|
||||
this.current.on('iterator', ({ iterator }, cb) => {
|
||||
if (!this.parsed) {
|
||||
this.stream = new SubtitleStream(this.stream, iterator)
|
||||
this.handleSubtitleParser(this.stream, true)
|
||||
cb(this.stream)
|
||||
const stream = new SubtitleStream(this.metadata, iterator)
|
||||
this.handleSubtitleParser(stream, true)
|
||||
cb(stream)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -143,6 +141,7 @@ class TorrentClient extends WebTorrent {
|
|||
stream.once('subtitle', () => {
|
||||
stream.destroy()
|
||||
})
|
||||
this.metadata = stream
|
||||
}
|
||||
|
||||
handleSubtitleParser (parser, skipFile) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue