Repository navigation
feat: 切换分集时自动沿用已手动选定的弹幕源 - #2709
LOVE-START wants to merge 1 commit into
Conversation
用户在弹幕源面板手动选定弹幕源并成功加载后,以 BgmBangumiID 为键 持久化记录弹幕源番剧 ID、所选弹幕源集号与选择时正在播放的 Bgm 集号; 同一部剧集切换分集时,按集号偏移直接沿用同一弹幕源的对应集,无需 重复手动选择。未记住、换算后集号非法、该集暂无弹幕或记忆源请求失败 时,回退到原有自动匹配逻辑,保证记忆失效时不会完全没有弹幕。
| unawaited(DanmakuSourceMemory.remember( | ||
| bgmBangumiId: widget.bangumiId, | ||
| animeId: animeId, | ||
| episodeNumber: danmakuEpisodeNumber, |
There was a problem hiding this comment.
WARNING: Remembered episode number is the list position, not the number encoded in the episode ID
danmakuEpisodeNumber comes from _visibleEpisodes, where it is just index + 1 in the DanDanPlay episode list. On replay, DanmakuApi.getDanDanmaku(animeId, sourceEpisode) builds the episode ID as '$animeId${sourceEpisode.padLeft(4, '0')}', so the stored value has to match the suffix of episode.episodeId, not the list index. The two drift apart when a source's numbering doesn't start at 1 (for example, a split-cour season listed as episodes 13–24) or when the list has a leading special/episode 0 entry. In that case the remembered source either can't resolve the episode the user just picked (it silently falls back to auto-match) or, worse, loads danmaku from a different episode of the same source, and the empty-result fallback won't catch that.
Derive the number from the selected episode's ID instead, e.g. pass episode into _rememberSelectedSource and store episode.episodeId % 10000. Only remember it when episode.episodeId ~/ 10000 == animeId, so episode IDs that don't follow this convention are never persisted.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (5 files)
Fix these issues in Kilo Cloud Reviewed by claude-opus-5.5 · Input: 270 · Output: 4.9K · Cached: 470.1K |
|
想知道这个PR还在你的视野范围内吗,你如何看待 kilo bot 提出的这个可能导致集数混乱的问题 |
|
以及 kilo bot 没有提过,离线缓存功能似乎绕过了此实现,这符合你的预期吗 |
描述
同一部剧集内切换分集时,弹幕源需重新手动选择并等待加载。现在用户手动选定并成功加载弹幕源后会被记住,后续切换分集直接沿用同一弹幕源的对应集。实现上以 BgmBangumiID 为键持久化「弹幕源番剧 ID + 选择时的弹幕源集号 + 选择时正在播放的 Bgm 集号」,用集号之差做偏移换算;加载时优先使用记忆源,未记住、换算后集号非法、该集暂无弹幕或记忆源请求失败时回退到原有自动匹配,保证不会因为记忆失效而完全没有弹幕。
关联的 Issues
无
PR 类型
AI 辅助开发
AI 辅助模型: glm5.3
提交前检查
附注
flutter analyze(无告警)与flutter test全量用例。