beets icon indicating copy to clipboard operation
beets copied to clipboard

embedart plugin - quality not used after call with import or fetchart (solution included)

Open azgnetov opened this issue 1 year ago • 1 comments

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)

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
$ 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

--- 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)

azgnetov avatar Aug 16 '25 18:08 azgnetov

Hi! I'd like to work on this. Could you assign it to me?

I'll apply the fix outlined in the issue so the embedart quality setting is also used when art is embedded automatically after import/fetchart, and add a test for that path.

I'll keep the PR small and focused on this issue.

aj-codespy avatar Oct 25 '26 15:10 aj-codespy