Skip to content

lyrics: handle apostrophes in musixmatch slug#6590

Merged
snejus merged 1 commit into
beetbox:masterfrom
eyupcanakman:fix/lyrics-musixmatch-apostrophe
Apr 28, 2026
Merged

lyrics: handle apostrophes in musixmatch slug#6590
snejus merged 1 commit into
beetbox:masterfrom
eyupcanakman:fix/lyrics-musixmatch-apostrophe

Conversation

@eyupcanakman
Copy link
Copy Markdown
Contributor

Description

REPLACEMENTS runs before unidecode in the musixmatch backend, so curly apostrophes (U+2018, U+2019) survived as raw bytes in the percent-encoded URL and titles like "If They're Shooting at You" produced a lookup that returned nothing. A new entry in REPLACEMENTS maps both codepoints to a dash. The shared slug() helper avoids the bug because it calls unidecode first.

Fixes #4759.

To Do

  • Documentation
  • Changelog
  • Tests

Copilot AI review requested due to automatic review settings April 28, 2026 14:08
@eyupcanakman eyupcanakman requested a review from a team as a code owner April 28, 2026 14:08
@github-actions github-actions Bot added the lyrics lyrics plugin label Apr 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

PR make lyrics plugin musixmatch URL slug handle curly apostrophe, so lookup no fail for titles like “If They’re Shooting at You”.

Changes:

  • Add musixmatch encode replacement for U+2018/U+2019 (and ') to - before URL quoting.
  • Add tests for lyrics.MusiXmatch.encode() around apostrophe cases.
  • Add changelog entry for bug :bug:\4759``.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
beetsplug/lyrics.py Teach MusiXmatch encoder to turn apostrophe chars into - so URL no percent-encode them.
test/plugins/test_lyrics.py Add regression tests for MusiXmatch encoder apostrophe handling.
docs/changelog.rst Note bug fix in changelog under Bug fixes.

The musixmatch URL slug builder did not replace curly apostrophes
(U+2018, U+2019) before applying the whitespace-to-dash rule, so titles
like "If They're Shooting at You" produced a slug with the raw quote
preserved and the lookup failed.

Add a REPLACEMENTS entry that maps both curly quote codepoints to a
dash before the rest of the substitutions run.
@eyupcanakman eyupcanakman force-pushed the fix/lyrics-musixmatch-apostrophe branch from a6f1c67 to 88be302 Compare April 28, 2026 14:27
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.05%. Comparing base (76a39eb) to head (88be302).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6590      +/-   ##
==========================================
+ Coverage   71.84%   72.05%   +0.21%     
==========================================
  Files         159      159              
  Lines       20562    20562              
  Branches     3260     3260              
==========================================
+ Hits        14772    14816      +44     
+ Misses       5102     5055      -47     
- Partials      688      691       +3     
Files with missing lines Coverage Δ
beetsplug/lyrics.py 86.58% <ø> (+8.48%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus snejus merged commit 20b0dd3 into beetbox:master Apr 28, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lyrics lyrics plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lyrics plugin syntax is being sent wrong

3 participants