beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.89k stars 1.82k forks source link

Discogs plugin is crashing album importing #4317

Closed zerinoid closed 2 years ago

zerinoid commented 2 years ago

Problem

If I disable it, importing works (but music brain doesn't have several of my albuns). I've trying deleting the config json and reinstalling the plugin, via pip.

Running this command in verbose (-vv) mode:

$ beet -vv import FOLDER

Led to this problem:

user configuration: /home/zerinol/.config/beets/config.yaml
data directory: /home/zerinol/.config/beets
plugin paths:
Sending event: pluginload
lastgenre: Loading canonicalization tree /usr/share/beets/beetsplug/lastgenre/genres-tree.yaml
ImageMagick version check failed: [Errno 2] No such file or directory: 'magick'
artresizer: method is (2, (6, 9, 11), True)
library database: /home/zerinol/.config/beets/musiclibrary.db
library directory: /home/zerinol/music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /home/zerinol/music/redacted/Yawning Portal - Heart & Earth [2020] (WEB - FLAC - Lossless)
Tagging Yawning Portal - Heart & Earth
No album ID found.
Search terms: Yawning Portal - Heart & Earth
Album might be VA: False
Searching for MusicBrainz releases with: {'release': 'heart & earth', 'artist': 'yawning portal', 'tracks': '5'}
Requesting MusicBrainz release a0e42308-86a8-4c8d-9605-78072f19138d
primary MB release type: album
Sending event: albuminfo_received
Candidate: Portal - Waves & Echoes (a0e42308-86a8-4c8d-9605-78072f19138d)
Computing track assignment...
...done.
Success. Distance: 0.73
Requesting MusicBrainz release ebd281e0-851d-4785-8794-2d37a0158179
primary MB release type: single
Sending event: albuminfo_received
Candidate: Yawning Sons - Shadows and Echoes (ebd281e0-851d-4785-8794-2d37a0158179)
Computing track assignment...
...done.
Success. Distance: 0.69
Requesting MusicBrainz release 267bb5f6-8679-413d-b661-596650098e54
primary MB release type: ep
Sending event: albuminfo_received
Candidate: Yawning - Selected Works (267bb5f6-8679-413d-b661-596650098e54)
Computing track assignment...
...done.
Success. Distance: 0.69
Requesting MusicBrainz release dd3df4dc-8d8b-4cfd-b4c6-b42970a230c9
primary MB release type: album
Sending event: albuminfo_received
Candidate: Vicki Hansen - Earth Heart (dd3df4dc-8d8b-4cfd-b4c6-b42970a230c9)
Computing track assignment...
...done.
Success. Distance: 0.72
Requesting MusicBrainz release cec77bbd-de2c-462a-8b9e-292456b10818
primary MB release type: album
Sending event: albuminfo_received
Candidate: Michel Portal - Our Meanings And Our Feelings (cec77bbd-de2c-462a-8b9e-292456b10818)
Computing track assignment...
...done.
Success. Distance: 0.73
Traceback (most recent call last):
  File "/usr/bin/beet", line 11, in <module>
    load_entry_point('beets==1.4.9', 'console_scripts', 'beet')()
  File "/usr/share/beets/beets/ui/__init__.py", line 1266, in main
    _raw_main(args)
  File "/usr/share/beets/beets/ui/__init__.py", line 1253, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/share/beets/beets/ui/commands.py", line 955, in import_func
    import_files(lib, paths, query)
  File "/usr/share/beets/beets/ui/commands.py", line 925, in import_files
    session.run()
  File "/usr/share/beets/beets/importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/share/beets/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/local/lib/python3.9/dist-packages/six.py", line 719, in reraise
    raise value
  File "/usr/share/beets/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/usr/share/beets/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/share/beets/beets/importer.py", line 1351, in lookup_candidates
    task.lookup_candidates()
  File "/usr/share/beets/beets/importer.py", line 641, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "/usr/share/beets/beets/autotag/match.py", line 457, in tag_album
    for matched_candidate in hooks.album_candidates(items,
  File "/usr/share/beets/beets/plugins.py", line 574, in decorated
    for v in generator(*args, **kwargs):
  File "/usr/share/beets/beets/autotag/hooks.py", line 620, in album_candidates
    for candidate in plugins.candidates(items, artist, album, va_likely):
  File "/usr/share/beets/beets/plugins.py", line 384, in candidates
    for candidate in plugin.candidates(items, artist, album, va_likely):
  File "/usr/share/beets/beetsplug/discogs.py", line 176, in candidates
    return self.get_albums(query)
  File "/usr/share/beets/beetsplug/discogs.py", line 237, in get_albums
    releases = self.discogs_client.search(query,
  File "/home/zerinol/.local/lib/python3.9/site-packages/discogs_client/client.py", line 134, in search
    fields['q'] = ' '.join(query)
TypeError: sequence item 0: expected str instance, bytes found

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

It happens with everything I try to import

Setup

My configuration (output of beet config) is:

directory: ~/music
library: ~/.config/beets/musiclibrary.db

import:
    copy: no
sort_item: albumartist+ album+ disc+ track+

plugins: discogs web fetchart embedart convert lastgenre
threaded: yes
embedart:
    maxwidth: 300
    ifempty: yes
    auto: yes
    compare_threshold: 0
    remove_art_file: no
convert:
    format: mp3
    formats:
        mp3:
            command: ffmpeg -i $source -codec:a libmp3lame -q:a 0 $dest
            extension: mp3
        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
        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
    dest:
    pretend: no
    threads: 8
    id3v23: inherit
    max_bitrate: 500
    auto: no
    tmpdir:
    quiet: no
    embed: yes

    paths: {}
    no_convert: ''
    never_convert_lossy_files: no
    copy_album_art: no
    album_art_maxwidth: 0
lastgenre:
    prefer_specific: yes
    canonical: yes
    whitelist: ~/.config/beets/whitelist
    min_weight: 10
    count: 1
    fallback:
    source: album
    force: yes
    auto: yes
    separator: ', '
web:
    host: 127.0.0.1
    port: 8337
    cors: ''
    cors_supports_credentials: no
    reverse_proxy: no
    include_paths: no
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 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
    store_source: no
discogs:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    user_token: REDACTED
sampsyo commented 2 years ago

Please see #2387; this arises because of an old version of the Discogs library.

zerinoid commented 2 years ago

I'm at the latest pypi version (2.3.14) of python3-discogs-client and it still gives the same result