beetbox / beets

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

Chroma Failure for fingerprinting a single file (but only that one file) #4091

Closed DanielDowling1 closed 3 years ago

DanielDowling1 commented 3 years ago

Problem

Running this command in verbose (-vv) mode:

$ beet -vv import /srv/datasrv/Mr\ Robot/Mac\ Quayle\ -\ Mr.\ Robot\,\ Vol.\ 7\ \(Original\ Television\ Series\ Soundtrack\)\ \(2019\)\ \(Hi-Res\)/ &> /srv/datasrv/traceback.txt 

Led to this problem:

user configuration: /home/daniel/.config/beets/config.yaml
data directory: /home/daniel/.config/beets
plugin paths: 
Sending event: pluginload
ImageMagick version check failed: [Errno 2] No such file or directory: 'magick'
artresizer: method is (2, (6, 9, 10), True)
library database: /home/daniel/.config/beets/library.db
library directory: /home/daniel/Music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
chroma: chroma: fingerprinted b'/srv/datasrv/Mr Robot/Mac Quayle - Mr. Robot, Vol. 7 (Original Television Series Soundtrack) (2019) (Hi-Res)/01 - 401.1 Retribution.flac'
chroma: no match found
chroma: chroma: fingerprinted b'/srv/datasrv/Mr Robot/Mac Quayle - Mr. Robot, Vol. 7 (Original Television Series Soundtrack) (2019) (Hi-Res)/02 - 401.2 Grand Central.flac'
chroma: no match found
Traceback (most recent call last):
  File "/usr/local/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/beets/ui/__init__.py", line 1291, in main
    _raw_main(args)
  File "/usr/local/lib/python3.8/dist-packages/beets/ui/__init__.py", line 1278, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python3.8/dist-packages/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python3.8/dist-packages/beets/ui/commands.py", line 943, in import_files
    session.run()
  File "/usr/local/lib/python3.8/dist-packages/beets/importer.py", line 341, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/lib/python3.8/dist-packages/beets/util/pipeline.py", line 442, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
    raise value
  File "/usr/local/lib/python3.8/dist-packages/beets/util/pipeline.py", line 309, in run
    out = self.coro.send(msg)
  File "/usr/local/lib/python3.8/dist-packages/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/local/lib/python3.8/dist-packages/beets/importer.py", line 1370, in lookup_candidates
    plugins.send('import_task_start', session=session, task=task)
  File "/usr/local/lib/python3.8/dist-packages/beets/plugins.py", line 498, in send
    result = handler(**arguments)
  File "/usr/local/lib/python3.8/dist-packages/beets/plugins.py", line 153, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/beetsplug/chroma.py", line 182, in fingerprint_task
    return fingerprint_task(self._log, task, session)
  File "/usr/local/lib/python3.8/dist-packages/beetsplug/chroma.py", line 251, in fingerprint_task
    acoustid_match(log, item.path)
  File "/usr/local/lib/python3.8/dist-packages/beetsplug/chroma.py", line 91, in acoustid_match
    duration, fp = acoustid.fingerprint_file(util.syspath(path))
  File "/usr/local/lib/python3.8/dist-packages/acoustid.py", line 340, in fingerprint_file
    return _fingerprint_file_audioread(path, maxlength)
  File "/usr/local/lib/python3.8/dist-packages/acoustid.py", line 280, in _fingerprint_file_audioread
    with audioread.audio_open(path) as f:
  File "/usr/local/lib/python3.8/dist-packages/audioread/__init__.py", line 111, in audio_open
    return BackendClass(path)
  File "/usr/local/lib/python3.8/dist-packages/audioread/ffdec.py", line 174, in __init__
    self._get_info()
  File "/usr/local/lib/python3.8/dist-packages/audioread/ffdec.py", line 230, in _get_info
    raise IOError('file not found')
OSError: file not found

Here's a link to the music files that trigger the bug (if relevant): 03 - 401.3 Contractor.flac https://musicbrainz.org/recording/d8a663cf-ad27-409a-9db5-ce1b605ce023 ^^ This is the only file that won't fingerprint. I can still generate a fingerprint via fpcalc from bash

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    google_API_key: REDACTED
    auto: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
    sources:
    - google
    - musixmatch
    - genius
    - tekstowo

plugins: chroma discogs deezer lyrics acousticbrainz fetchart embedart bandcamp

import:
    move: no
    copy: no
    write: yes
    autotag: yes
acousticbrainz:
    force: yes
    auto: yes
    tags: []
fetchart:
    google_key: REDACTED
    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_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    lastfm_key: REDACTED
    store_source: no
    high_resolution: no
acoustid:
    apikey: REDACTED
embedart:
    remove_art_file: yes
    compare_threshold: 10
    ifempty: yes
    maxwidth: 0
    auto: yes
    quality: 0
discogs:
    index_tracks: yes
    user_token: REDACTED
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    separator: ', '
bandcamp:
    art: yes
    preferred_media: Digital Media
    include_digital_only_tracks: yes
    search_max: 10
    lyrics: no
    exclude_extra_fields: []
chroma:
    auto: yes
deezer:
    source_weight: 0.5
sampsyo commented 3 years ago

Hmm… the "file not found" error indicates something weird going on where the filesystem itself is doing something weird. Is this on a network filesystem? If so, you could try copying the file somewhere local and fingerprinting again, which would let you "blame" the network filesystem. At that point, it's still not exactly clear how to reproduce the problem, but maybe it would indicate what's going wrong?

DanielDowling1 commented 3 years ago

Thanks for your response. The folder is stored locally on the filesystem, but under "/srv" in an exported samba share. The filesystem is also encrypted with LUKS. Following your advice, I moved the files in that one album to a directory I created in my home directory (~/music), whereupon it no longer seems to be throwing the exception, so perhaps it was an issue with access privileges or something. It could be that I'd forgotten to "chown" the directory of that album when I imported it into the filesystem, although doing an "ls -lah" on the moved directory shows me as the owner with full user access but no group write access (could that be it? -- but that wouldn't explain why it worked this time around).

In any case, since I was able to get it to work, we probably can "blame" the filesystem, and close out this issue.

sampsyo commented 3 years ago

Huh! That is pretty odd. I think the filesystem has something to do with this, but nonetheless, it would probably be a good idea for beets to log a sensible error message instead of crashing with a traceback (which is what I assume it did, right?). So maybe the chroma plugin just needs a little extra error handling.