Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail resizing depends on recently removed pillow feature #5120

Closed
carreter opened this issue Feb 23, 2024 · 2 comments
Closed

Thumbnail resizing depends on recently removed pillow feature #5120

carreter opened this issue Feb 23, 2024 · 2 comments

Comments

@carreter
Copy link

Seems like Pillow 10.0.0 removed some constants that break functionality.

Problem

Running this command in verbose (-vv) mode:

$ beet -vv thumbnails

Led to this problem:

user configuration: /home/willow/.config/beets/config.yaml
data directory: /home/willow/.config/beets
plugin paths: 
ImageMagick version check failed: [Errno 2] No such file or directory: 'magick'
ImageMagick version check failed: [Errno 2] No such file or directory: 'convert'
artresizer: method is (1, (0,))
ImageMagick version check failed: [Errno 2] No such file or directory: 'magick'
ImageMagick version check failed: [Errno 2] No such file or directory: 'convert'
thumbnails: using PIL to write metadata
thumbnails: using GIO to compute URIs
lastgenre: Loading canonicalization tree /usr/lib/python3.11/site-packages/beetsplug/lastgenre/genres-tree.yaml
lyrics: Disabling google source: no API key configured.
Sending event: pluginload
library database: /home/willow/.config/beets/library.db
library directory: /home/willow/Music
Sending event: library_opened
ImageMagick version check failed: [Errno 2] No such file or directory: 'magick'
ImageMagick version check failed: [Errno 2] No such file or directory: 'convert'
thumbnails: using PIL to write metadata
thumbnails: using GIO to compute URIs
thumbnails: generating thumbnail for Aphex Twin - Come to Daddy
artresizer: PIL resizing /home/willow/Music/Aphex Twin/Come to Daddy/cover.jpg to /home/willow/.cache/thumbnails/large/2bd56b58b1715e686e0753633c6486e3.png
Traceback (most recent call last):
  File "/usr/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets==1.6.0', 'console_scripts', 'beet')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "/usr/lib/python3.11/site-packages/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib/python3.11/site-packages/beetsplug/thumbnails.py", line 75, in process_query
    self.process_album(album)
  File "/usr/lib/python3.11/site-packages/beetsplug/thumbnails.py", line 129, in process_album
    wrote &= self.make_cover_thumbnail(album, 256, LARGE_DIR)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/beetsplug/thumbnails.py", line 152, in make_cover_thumbnail
    resized = ArtResizer.shared.resize(size, album.artpath,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/beets/util/artresizer.py", line 355, in resize
    return func(maxwidth, path_in, path_out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/beets/util/artresizer.py", line 75, in pil_resize
    im.thumbnail(size, Image.ANTIALIAS)
                       ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Here's a link to the music files that trigger the bug (if relevant): N/A

Setup

  • OS: Arch Linux x86_64
  • Python version: 3.11.7
  • beets version: 1.6.0
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
    sources:
    - google
    - musixmatch
    - genius
    - tekstowo
directory: ~/Music
library: ~/.config/beets/library.db

plugins: lastgenre fetchart playlist fuzzy lyrics convert missing thumbnails

import:
    move: yes
convert:
    auto: yes
    dest:
    pretend: no
    link: no
    hardlink: no
    threads: 8
    format: mp3
    id3v23: inherit
    formats:
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    max_bitrate: 500
    tmpdir:
    quiet: no
    embed: yes

    paths: {}
    no_convert: ''
    never_convert_lossy_files: no
    copy_album_art: no
    album_art_maxwidth: 0
    delete_originals: no
lastgenre:
    min_weight: 40
    prefer_specific: yes
    count: 3
    whitelist: yes
    fallback:
    canonical: no
    source: album
    force: yes
    auto: yes
    separator: ', '
    title_case: yes
thumbnails:
    auto: yes
    force: no
    dolphin: no
playlist:
    auto: no
    playlist_dir: .
    relative_to: library
    forward_slash: no
fuzzy:
    prefix: '~'
    threshold: 0.7
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 0
    quality: 0
    max_filesize: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    lastfm_key: REDACTED
    store_source: no
    high_resolution: no
    deinterlace: no
    cover_format:
missing:
    count: no
    total: no
    album: no

Workaround

Installing imagemagick allows beet thumbnails to execute properly.

@wisp3rwind
Copy link
Member

This is already fixed in #4868.

@carreter
Copy link
Author

carreter commented Mar 8, 2024

Oops, didn't see that issue. Any idea when this will be bundled into a release?

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

No branches or pull requests

2 participants