beetbox / beets

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

Beets autotagger crashes while importing. #3754

Closed jtweedie closed 3 years ago

jtweedie commented 3 years ago

Problem

Running beet import <directory> crashes out with the below stack trace immediately after selecting an action at the action prompt.

It doesn't seem to matter which files are being imported, nor which directory.

It only appears to crash on actions which result in metadata changes (ie. any candidate or import as Tracks.)

Any other options work fine.

Traceback

Traceback (most recent call last):
  File "C:\Python38\Scripts\beet-script.py", line 11, in <module>
    load_entry_point('beets==1.5.0', 'console_scripts', 'beet')()
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\__init__.py", line 1269, in main
    _raw_main(args)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\__init__.py", line 1256, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\commands.py", line 960, in import_func
    import_files(lib, paths, query)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\commands.py", line 930, in import_files
    session.run()
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\util\pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "C:\Python38\lib\site-packages\six.py", line 703, in reraise
    raise value
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\util\pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\util\pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\importer.py", line 1353, in lookup_candidates
    task.lookup_candidates()
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\importer.py", line 641, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 468, in tag_album
    _add_candidate(items, candidates, matched_candidate)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 374, in _add_candidate
    mapping, extra_items, extra_tracks = assign_items(items, info.tracks)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 102, in assign_items
    row.append(track_distance(item, track))
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 134, in track_distance
    if track_info.length:
AttributeError: 'str' object has no attribute 'length'

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    sources: lyricwiki musixmatch genius
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
directory: C:\Users\tweed\Music\Library
library: C:\Users\tweed\Music\BeetsLibrary.db

import:
    move: no
    copy: yes
    write: yes
    delete: no
    autotag: yes
    timid: no
    resume: ask
    incremental: no
    none_rec_action: ask
    log: C:\Users\tweed\Music\beetsimport.log
    quiet: no
    quiet_fallback: skip
    default_action: apply
    languages: []
    detail: no
per_disc_numbering: yes
art_filename: cover
original_date: yes

clutter:
- Thumbs.DB
- .DS_Store
- '*.m3u'
- .pls
- '*.jpg'
ignore: [.*, '*~', System Volume Information]
ignore_hidden: yes
threaded: yes
timeout: 5.0
verbose: no

paths:
    default: $albumartist/$album - ($year)/$track - $title
    singleton: Non-Album/$artist - $title
    comp: Compilations/$album ($year)/$track - $artist - $title

replace:
    '[\\/]': _
    ^\.: _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    \.$: _
    \s+$: ''
path_sep_replace: _

ui:
    color: yes
    colors:
        text_success: green
        text_warning: yellow
        text_error: red
        text_highlight: red
        text_highlight_minor: lightgray
        action_default: turquoise
        action: blue
    terminal_width: 150

plugins: the fetchart embedart lyrics scrub fromfilename ftintitle discogs chroma bandcamp lastgenre
fetchart:
    auto: yes
    midwidth: 400
    enforce_ratio: 10px
    fanarttv_key: REDACTED
    sources: filesystem itunes amazon albumart coverart wikipedia fanarttv
    minwidth: 0
    maxwidth: 0
    quality: 0
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    lastfm_key: REDACTED
    store_source: no
    high_resolution: no
embedart:
    auto: yes
    remove_art_file: yes
    maxwidth: 0
    compare_threshold: 0
    ifempty: no
    quality: 0
chroma:
    auto: yes
bandcamp:
    lyrics: no
    art: yes
    split_artist_title: no
    source_weight: 0.5
    min_candidates: 5
scrub:
    auto: no
lastgenre:
    auto: yes
    count: 1
    source: album
    whitelist: C:\Users\tweed\Music\Library\BeetsGenreWhitelist.txt
    min_weight: 10
    fallback:
    canonical: no
    force: yes
    separator: ', '
    prefer_specific: no
the:
    the: yes
    a: yes
    format: '{0}, {1}'
    strip: no
    patterns: []
discogs:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    user_token: REDACTED
    separator: ', '
    index_tracks: no
ftintitle:
    auto: yes
    drop: no
    format: feat. {0}

If this is a silly config issue please close and I'm happy to figure it out.

sampsyo commented 3 years ago

Hello! Just checking that you actually confirmed this:

  • Turning off plugins made problem go away (yes/no): no

I noticed that you are using a third-party plugin, so trying disabling plugins is important.

jtweedie commented 3 years ago

Can confirm I have run without plugins. I have now tried with a fresh minimal config (similar to the example one) and database also.

sampsyo commented 3 years ago

Huh! That's interesting. Can you also please include the full verbose log, as the issue template suggests? (Perhaps it's needless to say, but this is not a known issue and it's quite surprising that it happens every time for you—so there is likely something going wrong with the setup on your machine.)

jtweedie commented 3 years ago

Can do: heres the full log with -vv:

PS C:\Users\tweed> beet -vv import "C:\Users\tweed\Music\Library1\"
user configuration: C:\Users\tweed\AppData\Roaming\beets\config.yaml
data directory: C:\Users\tweed\AppData\Roaming\beets
plugin paths:
Sending event: pluginload
library database: C:\Users\tweed\Music\BeetsLibrary.db
library directory: C:\Users\tweed\Music\Library
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: C:\Users\tweed\Music\Library1\Acapella
Tagging a-ha -
No album ID found.
Search terms: a-ha -
Album might be VA: True
Evaluating 0 candidates.

C:\Users\tweed\Music\Library1\Acapella (13 items)
Sending event: before_choose_candidate
No matching release found for 13 tracks.
For help, see: https://beets.readthedocs.org/en/latest/faq.html#nomatch
[S]kip, Use as-is, as Tracks, Group albums, Enter search, enter Id, aBort? T
Sending event: import_task_choice
Sending event: import_task_created
Sending event: import_task_start
Traceback (most recent call last):
  File "C:\Python38\Scripts\beet-script.py", line 11, in <module>
    load_entry_point('beets==1.5.0', 'console_scripts', 'beet')()
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\__init__.py", line 1269, in main
    _raw_main(args)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\__init__.py", line 1256, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\commands.py", line 960, in import_func
    import_files(lib, paths, query)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\ui\commands.py", line 930, in import_files
    session.run()
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\util\pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "C:\Python38\lib\site-packages\six.py", line 703, in reraise
    raise value
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\util\pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\util\pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\importer.py", line 1353, in lookup_candidates
    task.lookup_candidates()
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\importer.py", line 641, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 468, in tag_album
    _add_candidate(items, candidates, matched_candidate)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 374, in _add_candidate
    mapping, extra_items, extra_tracks = assign_items(items, info.tracks)
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 102, in assign_items
    row.append(track_distance(item, track))
  File "C:\Python38\lib\site-packages\beets-1.5.0-py3.8.egg\beets\autotag\match.py", line 134, in track_distance
    if track_info.length:
AttributeError: 'str' object has no attribute 'length'
PS C:\Users\tweed>
jtweedie commented 3 years ago

Never mind, I've removed and reinstalled Python and beets from scratch and she works now with the same config used to generate that verbose log. So definately something screwy on my system. Sorry for wasting your time!

sampsyo commented 3 years ago

Weird! Glad you resolved it.