Skip to content

lyrics: move intrumental lyrics to a flexible attribute#6762

Open
snejus wants to merge 2 commits into
masterfrom
use-instrumental-lyrics-flexible-attr
Open

lyrics: move intrumental lyrics to a flexible attribute#6762
snejus wants to merge 2 commits into
masterfrom
use-instrumental-lyrics-flexible-attr

Conversation

@snejus

@snejus snejus commented Jun 21, 2026

Copy link
Copy Markdown
Member

Fixes #6719

  • This change shifts instrumental-track handling in the lyrics flow from storing the literal "[Instrumental]" in item.lyrics to storing that state as structured metadata in lyrics_instrumental.

  • At the architecture level, the source of truth is now the Lyrics value object in beets/util/lyrics.py: it normalizes instrumental results early, clears the lyrics text, and carries an instrumental flag through the rest of the pipeline.

  • The lyrics plugin then persists that flag as the flexible field lyrics_instrumental, alongside existing metadata like lyrics_backend and lyrics_url. This keeps canonical lyrics text clean while preserving whether the track was identified as instrumental.

  • A new library migration, InstrumentalLyricsInFlexFieldMigration, updates existing databases by moving legacy "[Instrumental]" values out of the main lyrics column and into the flexible attribute. This makes old data match the new model automatically.

  • Docs and tests were updated to reflect the new behavior, so reviewers can think of this as a small data-model cleanup with backward-compatible migration: cleaner lyrics content, explicit instrumental metadata, and automatic upgrade for existing libraries.

@snejus snejus requested a review from a team as a code owner June 21, 2026 09:37
Copilot AI review requested due to automatic review settings June 21, 2026 09:37
@github-actions github-actions Bot added the lyrics lyrics plugin label Jun 21, 2026
@snejus snejus force-pushed the use-instrumental-lyrics-flexible-attr branch from 16c3731 to bf74cb6 Compare June 21, 2026 09:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

grug see PR try make lyrics for instrumental track clean. no more store magic text "[Instrumental]" inside item.lyrics. instead store empty lyrics text, and carry “instrumental” state as metadata (lyrics_instrumental) with migration for old libraries.

Changes:

  • add instrumental flag to beets.util.lyrics.Lyrics, and normalize legacy "[Instrumental]" into empty text + flag
  • lyrics plugin now persist lyrics_instrumental flex field alongside other lyrics metadata
  • add DB migration to move legacy "[Instrumental]" out of items.lyrics into lyrics_instrumental, plus docs/tests updates

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
beets/util/lyrics.py add instrumental flag + normalize legacy instrumental marker to empty lyrics text
beetsplug/lyrics.py register lyrics_instrumental flex type and persist it from Lyrics object
beets/library/migrations.py new migration to move legacy "[Instrumental]" marker to flex field
beets/library/library.py register new migration in library migration list
test/util/test_lyrics.py update expectations for instrumental normalization + flag
test/plugins/test_lyrics.py update plugin expectations for instrumental behavior
test/library/test_migrations.py add regression test for new migration behavior
docs/plugins/lyrics.rst document new lyrics_instrumental flex attribute + empty lyrics behavior
docs/changelog.rst changelog entry for new instrumental handling + migration

Comment thread beets/library/migrations.py Outdated
@snejus snejus force-pushed the use-instrumental-lyrics-flexible-attr branch from bf74cb6 to 974aa56 Compare June 21, 2026 09:48
@snejus snejus requested a review from Copilot June 21, 2026 09:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

item = helper.lib.get_item(item.id)

assert item.lyrics_url == lyrics.url
assert item.lyrics_instrumental == "0"
regular_item.load()

assert instrumental_item.lyrics == ""
assert instrumental_item.lyrics_instrumental == "1"
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.06%. Comparing base (37e2a8b) to head (f7b6c7d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6762      +/-   ##
==========================================
+ Coverage   74.85%   75.06%   +0.20%     
==========================================
  Files         163      163              
  Lines       20947    20967      +20     
  Branches     3299     3301       +2     
==========================================
+ Hits        15680    15739      +59     
+ Misses       4510     4468      -42     
- Partials      757      760       +3     
Files with missing lines Coverage Δ
beets/library/library.py 93.18% <ø> (ø)
beets/library/migrations.py 97.87% <100.00%> (+0.23%) ⬆️
beets/util/lyrics.py 96.90% <100.00%> (+0.20%) ⬆️
beetsplug/lyrics.py 89.78% <100.00%> (+7.51%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus snejus force-pushed the use-instrumental-lyrics-flexible-attr branch 2 times, most recently from f1105fe to 6a8c907 Compare June 28, 2026 00:37
snejus added 2 commits June 28, 2026 02:44
- Leave lyrics text empty when a backend reports an instrumental track and
  persist that state in lyrics_instrumental.
@snejus snejus force-pushed the use-instrumental-lyrics-flexible-attr branch from 6a8c907 to f7b6c7d Compare June 28, 2026 01:45
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.

do not add lyrics when instrumental is detected

2 participants