Optimize danmaku matching for segment's skipping #111
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
本次 Pull Request 包含了对弹幕时间和偏移匹配的正则表达式处理的更新,匹配格式包括:“01:23”“四分五十六秒”“1分2秒”“向右12下”“右方向34次”等
弹幕正则表达式模式的更新:
public/_locales/en/en.messages.json
、public/_locales/en/messages.json
、public/_locales/zh_CN/messages.json
、public/_locales/zh_TW/messages.json
:将danmakuRegexPattern
重命名为danmakuTimeMatchingRegexPattern
,并为danmakuOffsetMatchingRegexPattern
添加了新的消息。代码库修改:
src/config.ts
:更新了配置接口和默认值,替换了danmakuRegexPattern
为danmakuTimeMatchingRegexPattern
和danmakuOffsetMatchingRegexPattern
。在迁移函数中移除了旧的danmakuRegexPattern
参数。src/content.ts
:用新的parseTargetTimeFromDanmaku
函数替代了现有的弹幕正则解析逻辑。src/utils/danmakusUtils.ts
:为新的两个参数提供设置输入框。UI更新:
public/options/options.html
:更新了HTML元素,使用了新的弹幕正则表达式模式标识符,并为偏移正则模式添加了新的输入字段。效果示例
匹配弹幕
设置页面
后续开发方向
本次正则匹配更新能匹配更多的空降弹幕,在目前条件下可能会造成多个弹窗堆积。后续,计划通过算法将多个匹配结果汇总为一个高置信度的空降时间,以供用户跳过。