embedart plugin - quality not used after call with import or fetchart (solution included)
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
## Problem
The quality is not used during common import or `fetchart` call
### Summary
The `embedart` plugin ignores the `quality` configuration parameter when automatically embedding artwork triggered by the `fetchart` plugin, but correctly uses it when run manually via `beet embedart` command.
### Expected Behavior
When `fetchart` automatically triggers `embedart` (via `art_set` event), the `quality` setting from the `embedart` configuration should be respected.
### Actual Behavior
The `quality` parameter is ignored during automatic embedding, defaulting to 0 (lowest quality), while manual `beet embedart` commands work correctly with the configured quality value.
## Environment
OS: Windows 10
Python version: 3.13.6
beets version: 2.3.1
### Config (part)
```yaml
import:
write: yes # write metadata to music files
move: no # move/copy imported files from source to the music directory
copy: yes
delete: no
incremental: yes
duplicate_action: merge
duplicate_verbose_prompt: yes
from_scratch: yes
log: ~\Music\musiclibrary.log
plugins: inline lastgenre discogs fetchart embedart chroma lyrics autobpm
fetchart:
auto: yes
cover_names: cover front folder album
sources:
- filesystem
- itunes
- lastfm
lastfm_key: '...'
cautious: yes
minwidth: 300
maxwidth: 1200
quality: 90
enforce_ratio: 10%
embedart:
auto: yes
maxwidth: 600
quality: 90
```
## Steps to reproduce
1. Import with enabled fetchart and embedart plugins any album
2. Check log and audio files
```sh
$ beet -vv fetchart -f
fetchart: trying source filesystem for album Eden weint im Grab - Der Herbst des Einsamen
fetchart: trying source itunes for album Eden weint im Grab - Der Herbst des Einsamen
fetchart: getting URL: https://itunes.apple.com/search?term=Eden+weint+im+Grab+Der+Herbst+des+Einsamen&entity=album&media=music&limit=200
fetchart: downloading image: https://is1-ssl.mzstatic.com/image/thumb/Music/0e/47/10/mzi.gafghkco.jpg/1200x1200bb.jpg
fetchart: downloaded art to: C:\Users\ALEXAN~1\AppData\Local\Temp\beets\beetsplug_fetchart\9yjzwqnz.jpg
fetchart: image size: (1200, 1200)
fetchart: using remote image C:\Users\ALEXAN~1\AppData\Local\Temp\beets\beetsplug_fetchart\9yjzwqnz.jpg
fetchart: image size: (1200, 1200)
Sending event: art_set
embedart: Resizing album art to 600 pixels wide and encoding at quality level 0
artresizer: PIL resizing \\?\C:\Users\alexander\Music\Auto\Eden weint im Grab\2009 - Der Herbst des Einsamen\cover.jpg to C:\Users\ALEXAN~1\AppData\Local\Temp\beets\util_artresizer\resize_PIL_np3s6fnx.jpg
embedart: Embedding album art into Eden weint im Grab - Der Herbst des Einsamen
```
## Patch
```py
--- embedart.py.orig 2024-01-01 00:00:00.000000000 +0000
+++ embedart.py 2024-01-01 00:00:01.000000000 +0000
@@ -264,6 +264,7 @@
max_width,
True,
self.config["compare_threshold"].get(int),
self.config["ifempty"].get(bool),
+ quality=self.config["quality"].get(int),
)
self.remove_artfile(album)
```
Contributor guide
Research direction
Start in embedart.py at the automatic artwork handling shown in the patch, and compare it with the manual beet embedart path. Verify that fetchart-triggered embedding passes the configured quality value instead of defaulting to 0, using the reproduction steps and verbose log to confirm the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100