beetbox / pyacoustid

Python bindings for Chromaprint acoustic fingerprinting and the Acoustid Web service
MIT License
332 stars 66 forks source link

Add support for bytearray in chromaprint #31

Closed interfect closed 8 years ago

interfect commented 8 years ago

As noted in my comments on https://github.com/beetbox/beets/issues/1958, Beets seems to want to send bytearrays into Chromaprint, which currently wants only bytes. I have no idea how to fix it on Beets's end, so here's a PR that does the conversion.

When I just pass bytearrays on through, some other type-checking code complains about it being the wrong type, so I opted for the (possibly inefficient) conversion instead.

sampsyo commented 8 years ago

Thanks for looking into this! You're right that something else might be going on… this could be the right fix, but let's do some due diligence if you don't mind.

Can you include some system details? Specifically:

In particular, I'm trying to get at the Audioread backend that's getting triggered for you, which should tell us what code is producing bytearrays.

interfect commented 8 years ago

I was trying to fingerprint MP3 files. I have libgstreamer1.0-0 version 1.8.2-1~ubuntu1, python-gobject-2 version 2.28.6-12ubuntu1, and ffmpeg version 7:2.8.6-1ubuntu2 all installed.

On Sun, Jul 31, 2016 at 7:55 PM, Adrian Sampson notifications@github.com wrote:

Thanks for looking into this! You're right that something else might be going on… this could be the right fix, but let's do some due diligence if you don't mind.

Can you include some system details? Specifically:

  • What file types were you trying to fingerprint?
  • Do you have GStreamer and python-gobject installed?
  • Do you have ffmpeg installed?

In particular, I'm trying to get at the Audioread https://github.com/beetbox/audioread backend that's getting triggered for you, which should tell us what code is producing bytearrays.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beetbox/pyacoustid/pull/31#issuecomment-236478659, or mute the thread https://github.com/notifications/unsubscribe-auth/AAt5tqg5VXvKuqBlUPyqCiC9F5WyE2YTks5qbWAUgaJpZM4JZI_I .

sampsyo commented 8 years ago

OK, sorry for the wild goose chase, but what about the package that Ubuntu calls python-gi? (Confusingly, that's the modern version of pygobject—I don't know why they couldn't choose clearer names.)

stefanor commented 8 years ago

I've seen bytearrays when pymad reads MP3s.

sampsyo commented 8 years ago

That's very useful to know; thank you!

interfect commented 8 years ago

To answer your earlier question, I have python-gi 3.20.0-0ubuntu1 installed.

On Wed, Aug 24, 2016 at 1:01 PM, Adrian Sampson notifications@github.com wrote:

That's very useful to know; thank you!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beetbox/pyacoustid/pull/31#issuecomment-242189715, or mute the thread https://github.com/notifications/unsubscribe-auth/AAt5tlh3rzGRU-G9zbpb1cDqTTjEcpl5ks5qjKMZgaJpZM4JZI_I .

sampsyo commented 8 years ago

I was finally able to nail down this problem: indeed, pymad has started returning bytearray objects. It's not in that project's changelog, but here's the commit that made the change: https://github.com/jaqx0r/pymad/commit/0231d165dcc192e769b9480cbe5bc2586feb8fc1#comments

So we now accept that type as input.