mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add convert functions
This commit is contained in:
parent
530699236b
commit
12cea98f65
@ -55,12 +55,8 @@
|
||||
this.colorTag = colorTag;
|
||||
this.endTime = endTime;
|
||||
}
|
||||
text(fontStyles, blockTypes)
|
||||
text(fontStyles)
|
||||
{
|
||||
if (blockTypes.concat(7, 8).indexOf(this.type) !== -1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
const styleName = fontStyles[this.fontSize].match(/Style:(.*?),/)[1].trim();
|
||||
return `Dialogue: 0,${this.time},${this.endTime},${styleName},,0,0,0,,{${this.typeTag}${this.colorTag}}${this.content}`;
|
||||
}
|
||||
@ -123,7 +119,22 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
const assDanmakus = [];
|
||||
for (const xmlDanmaku of xmlDanmakuDocument.danmakus)
|
||||
{
|
||||
|
||||
// 跳过高级弹幕和设置为屏蔽的弹幕类型
|
||||
if (this.blockTypes.concat(7, 8).indexOf(xmlDanmaku.type) !== -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const [startTime, endTime] = this.convertTime(xmlDanmaku.time, this.duration);
|
||||
assDanmakus.push(new AssDanmaku({
|
||||
content: xmlDanmaku.content,
|
||||
time: startTime,
|
||||
endTime: endTime,
|
||||
type: xmlDanmaku.type,
|
||||
fontSize: xmlDanmaku.fontSize,
|
||||
color: xmlDanmaku.color,
|
||||
typeTag: this.convertType(xmlDanmaku.type),
|
||||
colorTag: this.convertColor(xmlDanmaku.color),
|
||||
}));
|
||||
}
|
||||
return new AssDanmakuDocument({
|
||||
danmakus: assDanmakus,
|
||||
@ -132,6 +143,10 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
fontStyles: this.fontStyles,
|
||||
});
|
||||
}
|
||||
convertType(type)
|
||||
{
|
||||
// TODO: Convert type
|
||||
}
|
||||
convertColor(decColor)
|
||||
{
|
||||
const white = 16777215;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user