beets: Chroma plugin errors out

Traceback (most recent call last):
  File "/usr/local/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.19', 'console_scripts', 'beet')()
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 1266, in main
    _raw_main(args)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 1253, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/chroma.py", line 197, in fingerprint_cmd_func
    fingerprint_item(self._log, item, write=ui.should_write())
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/chroma.py", line 298, in fingerprint_item
    _, fp = acoustid.fingerprint_file(item.path)
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 321, in fingerprint_file
    return _fingerprint_file_audioread(path, maxlength)
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 264, in _fingerprint_file_audioread
    fp = fingerprint(f.samplerate, f.channels, iter(f), maxlength)
  File "/usr/local/lib/python2.7/dist-packages/acoustid.py", line 206, in fingerprint
    fper.feed(block)
  File "/usr/local/lib/python2.7/dist-packages/chromaprint.py", line 119, in feed
    raise TypeError('data must be bytes, buffer, or memoryview')
TypeError: data must be bytes, buffer, or memoryview

Problem

(Describe your problem, feature request, or discussion topic here. If you’re reporting a bug, please fill out this and the “Setup” section below. Otherwise, you can delete them.)

Running this command in verbose (-vv) mode:

$ beet -vv (... paste here ...)

Led to this problem:

(paste here)

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

Setup

  • OS: ubuntu 16.04
  • Python version: 2.7
  • beets version: 1.3.18
  • Turning off plugins made problem go away (yes/no): yes

My configuration (output of beet config) is:

(paste here)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 39 (17 by maintainers)

Commits related to this issue

Most upvoted comments

FWIW, I just ran into this issue myself.

When I modify this function:

def feed(self, data):
        """Send raw PCM audio data to the fingerprinter. Data may be
        either a bytestring or a buffer object.
        """
        if isinstance(data, BUFFER_TYPES):
            data = str(data)
        elif not isinstance(data, bytes):
            raise TypeError('data must be bytes, buffer, or memoryview')
        _check(_libchromaprint.chromaprint_feed(
            self._ctx, data, len(data) // 2
        ))

to this:

def feed(self, data):
        """Send raw PCM audio data to the fingerprinter. Data may be
        either a bytestring or a buffer object.
        """
        if isinstance(data, BUFFER_TYPES):
            data = str(data)
        elif isinstance(data, bytearray):
            data = bytes(data)
        elif not isinstance(data, bytes):
            raise TypeError('data must be bytes, buffer, or memoryview')
        _check(_libchromaprint.chromaprint_feed(
            self._ctx, data, len(data) // 2
        )

It runs without issue. That function is located in this location https://github.com/beetbox/pyacoustid/blob/master/chromaprint.py and on my box is located at path: /usr/local/lib/python2.7/dist-packages/chromaprint.py

This is just a heads up to anyone else that googles the error code and finds a github issue, which I find is always a bad sign. It’s a hack and a workaround but I’m not the project maintainer, I just want it to work, I don’t mind if it takes longer (because I just copied a crap ton of bytes unnecessarily, I’m assuming.)