Embedart normalize by Sabrina04072003 · Pull Request #7079 · beetbox/beets · GitHub
Skip to content

Embedart normalize - #7079

Open
Sabrina04072003 wants to merge 6 commits into
beetbox:masterfrom
Sabrina04072003:embedart-normalize
Open

Sabrina04072003 wants to merge 6 commits into
beetbox:masterfrom
Sabrina04072003:embedart-normalize

Conversation

@Sabrina04072003

@Sabrina04072003 Sabrina04072003 commented Oct 5, 2026 •

Copy link
Copy Markdown

Description

Fixes #7068.

This PR adds a new option to the embedart plugin: normalize. It is off by default.

When it is on, and maxwidth is set, big covers inside the music files are made smaller after an album is imported. This works even if fetchart finds no new cover. Small covers are not changed. Files without a cover are skipped.

How it works

  • When normalize is on, the plugin listens to the album_imported event. This event is sent after each album import.
  • For each track of the album, the plugin runs normalize_item.
  • normalize_item does this:
    • It takes the cover out of the file (art.extract).
    • It checks the width of the cover (ArtResizer.shared.get_size).
    • If there is no cover, or it is not wider than maxwidth, it does nothing.
    • If not, it makes the cover smaller and puts it back in the file with art.embed_item.
  • I used album_imported and not art_set. The art_set event only happens when a new cover is found. This way it works in all cases, as the issue asks.
  • Like the existing auto-embedding, it does nothing when import: write is off.

Design notes

  • I added a new normalize option (one of the two ideas in the issue). So maxwidth works the same as before.
  • The check uses the width only, as maxwidth is described in the docs. A tall image that is not wider than maxwidth would not be changed.

AI usage

I wrote this change with the help of an AI assistant (Claude). I am a Master's student and this is my first contribution to beets. I set up the project on Windows, applied the changes, and ran the tests and the linter myself. I will answer any questions about the code myself.

Testing

  • I added 6 tests in test/plugins/test_embedart.py:
    • a big cover is made smaller,
    • a small cover is not changed,
    • the option is off by default,
    • an album without a cover works without errors,
    • the option does nothing when import: write is off,
    • the option does nothing when maxwidth is not set.
  • poe test test/plugins/test_embedart.py passes on Windows: 28 passed, 4 skipped. The 4 skipped tests need ImageMagick or ffmpeg, which I do not have.
  • poe lint passes.

To Do

  • Documentation. (The new option is in docs/plugins/embedart.rst.)
  • Changelog. (A new line is in docs/changelog.rst.)
  • Tests.

@Sabrina04072003
Sabrina04072003 requested a review from a team as a code owner October 5, 2026 20:21
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

@Sabrina04072003

Copy link
Copy Markdown
Author

Hi, I have resolved the merge conflicts in docs/changelog.rst by keeping both changelog entries for the new features.

@Sabrina04072003

Copy link
Copy Markdown
Author

hi @Troox73, I hope you are doing well! This is a friendly reminder about this PR (the new normalize option for embedart, for #7068).
All the checks are passing.
When you have time, I would be happy to get your feedback. Thank you!

@Troox73

Troox73 commented Oct 16, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Normalize existing embedded artwork to fetchart/embedart maxwidth

2 participants