beetbox / pyacoustid

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

Expose chromaprint errors as exceptions #28

Closed dsvensson closed 9 years ago

dsvensson commented 9 years ago

When passing too little data to fingerprint, the following is printed on stderr:

Chromaprint::FingerprintCalculator::Calculate() -- Not enough data. Image has 10 rows, needs at least 16 rows.

Perhaps an error printed in libchromaprint, and if so, coordinate with upstream project.

lalinsky commented 9 years ago

These are debug messages which you should not see if you compile chromaprint in release mode.

When you don't provide enough data, you currently get an empty fingerprint back. Changing that behavior to an error makes sense, but that's a chromaprint change.

dsvensson commented 9 years ago

I actually get a 6 character long result back, silly example to reproduce:

>>> import acoustid
>>> len(acoustid.fingerprint(44100, 2, [b'1'*100000]))
Chromaprint::FingerprintCalculator::Calculate() -- Not enough data. Image has 0 rows, needs at least  16 rows.
6

Seems like Fedora F22 has messed up libchromaprint then wrt the debug message.

lalinsky commented 9 years ago

Yeah, that's the encoded version which always has a fixed-length header. The raw fingerprint is actually empty.

dsvensson commented 9 years ago

Alright.. that takes care of that then. Thanks.