Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(lyrics): keep brackets inside LRC metadata tag values

open
#466 opened by Levisongithub-forks/levison-openkara:fix/lyrics-bracketed-metadata-tags→dev/openkara:main
Conversation3
Levison
Commits
0
Files changed…
opened this pull request
Author
· 6 days ago

Summary

parse_lrc_metadata stops at the first ], so [ti:Vision [Radio Edit]] parses as the title Vision [Radio Edit. import_lyrics_files compares the tag against the song's title exactly, so such an .lrc matches no song and is reported unmatched.

Changes

  • Find the closing ] by bracket depth (find_tag_close) instead of taking the first one.
  • Regression tests for bracketed values, and for the two behaviours that stay the same.

Acceptance criteria

  1. Balanced brackets in [ti:], [ar:] and [al:] are kept — parse_lrc_metadata_keeps_brackets_inside_values.
  2. [ar:X][ti:Y] on one line still reads the first tag, and a value whose brackets never balance still falls back to the last ] — parse_lrc_metadata_handles_unbalanced_brackets_in_values.
  3. Such an .lrc matches on import — manual: 23 audio files and their .lrc files into an empty library on Windows, all 23 matched. The Vision [Radio Edit] title was unmatched before this change.

Test plan

  • cd src-tauri && cargo test — 1219 passed. Its 19 failures also fail on unmodified main in this environment. nextest isn't installed here.
  • cargo clippy --all-targets -- -D warnings — its 2 errors also occur on unmodified main here, both outside the changed code.
  • node --run lint and node --run build — pass; no frontend change.
  • docs/references/contracts/*.md — no IPC command, payload or event changed.
  • Product standards: lifecycle, quality and testing. ISO 25010 functional correctness. Regression coverage added; no ADR.

Related issues

Closes #465

🤖 Generated with Claude Code

parse_lrc_metadata now preserves balanced brackets in [ti:], [ar:], and [al:] values. This allows LRC files with values such as Vision [Radio Edit] to match songs during lyrics import. Unbalanced bracket values retain the existing behavior.

coderabbitai[bot]commented· 6 days ago

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: thedavidweng/OpenKara/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 18b0e21d-20a2-487f-8690-8805f93dd4da

📥 Commits

Reviewing files that changed from the base of the PR and between 2fc59a5d5f7480b8056118f59c3a894795da20dd and 8f7e0b25a101d45b44e7ca0f662ce0a17f82d2e9.

📒 Files selected for processing (1)
  • src-tauri/src/lyrics/parser.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

parse_lrc_metadata now preserves balanced square brackets in metadata values. It falls back to the final closing bracket for unbalanced values. Tests cover title and album metadata.

Changes

LRC metadata parsing

Layer / File(s)Summary
Metadata bracket handling
src-tauri/src/lyrics/parser.rs
parse_lrc_metadata uses find_tag_close to locate the outer closing bracket. The helper tracks nested brackets and handles unbalanced values. Tests cover balanced and unbalanced title and album values.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: thedavidweng

Merge Risk: ⚪ Minimal · up to 8f7e0

This change preserves bracketed LRC metadata so matching lyrics can use the intended title and artist values. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title uses the valid Conventional Commits prefix "fix", includes a relevant optional scope, and clearly describes the LRC metadata bracket parsing correction.
Linked Issues check✅ PassedIssue #465 requires balanced brackets in [ti:], [ar:], and [al:] values. parse_lrc_metadata now calls find_tag_close, which skips nested brackets and selects the outer closing bracket. The n…
Out of Scope Changes check✅ PassedThe pull request changes only src-tauri/src/lyrics/parser.rs. The helper modifies tag-close detection, and the added tests cover the linked parsing behavior. These changes directly support Issue #46…
Ipc Contract Update✅ PassedThe PR changes only src-tauri/src/lyrics/parser.rs. It updates parse_lrc_metadata behavior, adds the private find_tag_close helper, and adds tests. No public IPC command, payload, event, or sour…
No Type Escapes✅ PassedThe pull request changes only src-tauri/src/lyrics/parser.rs. The authoritative diff contains no TypeScript or TSX files, so it adds no as any, [@ts-ignore](/ts-ignore), or [@ts-expect-error](/ts-expect-error).
Acceptance Evidence✅ PassedAll three PR acceptance criteria have explicit evidence. Criterion 1 names parse_lrc_metadata_keeps_brackets_inside_values, and the changed file contains that regression test. Criterion 2 names `par…
Do Not Edit Changelog✅ PassedThe authoritative pull-request diff changes only src-tauri/src/lyrics/parser.rs. No CHANGELOG.md file is changed, so the custom check passes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment [@coderabbitai](/coderabbitai) help to get the list of available commands.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
kilo-code-bot[bot]commented· 6 days ago

Code Review Summary

This review did not finish. The model reached its output limit before it could write the review — a reasoning model can spend the whole budget thinking. Re-run the review, or lower the model's thinking effort, and it should get further. Any inline comments below are from an earlier review.

devcommented· 11 hours ago

Thanks a lot!

Workflows from forks require approval

CI will not run on this pull request until someone with write access on the target repository approves workflows for commit 8f7e0b2. Secrets stay withheld for fork PRs.

Waiting for a target-repo writer to approve.

This branch can’t be merged automatically yet
Branch comparison failed — verify branches still exist in storage.
0 approving reviews
None yet
Checks
Workflows from forks require approval
Fast-forward
Source must contain the target branch tip
main ← fix/lyrics-bracketed-metadata-tags

Sign in to comment.

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.