Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize danmaku matching for segment's skipping #111

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

xiaoxuan010
Copy link
Contributor

@xiaoxuan010 xiaoxuan010 commented Dec 24, 2024

  • 我同意我的所有贡献将以GPL-3.0协议开源。

本次 Pull Request 包含了对弹幕时间和偏移匹配的正则表达式处理的更新,匹配格式包括:“01:23”“四分五十六秒”“1分2秒”“向右12下”“右方向34次”等

弹幕正则表达式模式的更新:

  • public/_locales/en/en.messages.jsonpublic/_locales/en/messages.jsonpublic/_locales/zh_CN/messages.jsonpublic/_locales/zh_TW/messages.json:将danmakuRegexPattern重命名为danmakuTimeMatchingRegexPattern,并为danmakuOffsetMatchingRegexPattern添加了新的消息。

代码库修改:

  • src/config.ts:更新了配置接口和默认值,替换了danmakuRegexPatterndanmakuTimeMatchingRegexPatterndanmakuOffsetMatchingRegexPattern。在迁移函数中移除了旧的danmakuRegexPattern参数。

  • src/content.ts:用新的parseTargetTimeFromDanmaku函数替代了现有的弹幕正则解析逻辑。

  • src/utils/danmakusUtils.ts:为新的两个参数提供设置输入框。

UI更新:

  • public/options/options.html:更新了HTML元素,使用了新的弹幕正则表达式模式标识符,并为偏移正则模式添加了新的输入字段。

效果示例

匹配弹幕

1735048531482

设置页面

1735048531482

后续开发方向

本次正则匹配更新能匹配更多的空降弹幕,在目前条件下可能会造成多个弹窗堆积。后续,计划通过算法将多个匹配结果汇总为一个高置信度的空降时间,以供用户跳过。

@xiaoxuan010 xiaoxuan010 force-pushed the optimize-danmaku-matching branch from 615463f to 7bc735f Compare December 24, 2024 14:21
@xiaoxuan010
Copy link
Contributor Author

强制推送 7bc735f,修复了若干处代码风格问题。

@xiaoxuan010 xiaoxuan010 force-pushed the optimize-danmaku-matching branch from 7bc735f to 829c604 Compare December 25, 2024 05:57
public/options/options.html Outdated Show resolved Hide resolved
@xiaoxuan010 xiaoxuan010 force-pushed the optimize-danmaku-matching branch from 829c604 to 5d5e148 Compare December 25, 2024 11:32
@hanydd hanydd merged commit 7d0f611 into hanydd:master Dec 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants