mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix danmaku orders (fix #3739)
This commit is contained in:
parent
4b53e12b86
commit
f48bdb6b8b
@ -70,7 +70,7 @@ export class JsonDanmaku {
|
||||
const result = await decodeDanmakuSegment(blob)
|
||||
return result.elems ?? []
|
||||
}))
|
||||
this.jsonDanmakus = segments.flat().sort(ascendingSort(it => it.progress))
|
||||
this.jsonDanmakus = segments.flat().sort(ascendingSort(it => it.progress ?? 0))
|
||||
return this
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ export const convertToAssFromJson = async (danmaku: JsonDanmaku) => {
|
||||
export const convertToXmlFromJson = (danmaku: JsonDanmaku) => {
|
||||
const xmlText = `
|
||||
<?xml version="1.0" encoding="UTF-8"?><i><chatserver>chat.bilibili.com</chatserver><chatid>${danmaku.cid}</chatid><mission>0</mission><maxlimit>${danmaku.xmlDanmakus.length}</maxlimit><state>0</state><real_name>0</real_name><source>k-v</source>
|
||||
${danmaku.xmlDanmakus.map(x => new XmlDanmaku(x).text()).join('\n')}
|
||||
${danmaku.xmlDanmakus.map(x => ` ${new XmlDanmaku(x).text()}`).join('\n')}
|
||||
</i>
|
||||
`.trim()
|
||||
return xmlText
|
||||
@ -262,7 +262,7 @@ export const getBlobByType = async (type: DanmakuDownloadType, input: {
|
||||
}
|
||||
default:
|
||||
case 'json': {
|
||||
return new Blob([JSON.stringify(danmaku.jsonDanmakus)], {
|
||||
return new Blob([JSON.stringify(danmaku.jsonDanmakus, undefined, 2)], {
|
||||
type: 'text/json',
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user