lyrics: handle apostrophes in musixmatch slug#6590
Merged
snejus merged 1 commit intoApr 28, 2026
Conversation
Contributor
There was a problem hiding this comment.
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.
a6f1c67 to
88be302
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
snejus
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
REPLACEMENTSruns beforeunidecodein themusixmatchbackend, 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 inREPLACEMENTSmaps both codepoints to a dash. The sharedslug()helper avoids the bug because it callsunidecodefirst.Fixes #4759.
To Do
Documentation