Commit 8a0c526d authored by Sandro Tosi's avatar Sandro Tosi

New upstream version 1.1.5

parent 64607894
Metadata-Version: 1.1
Name: pyacoustid
Version: 1.1.2
Version: 1.1.5
Summary: bindings for Chromaprint acoustic fingerprinting and the Acoustid API
Home-page: https://github.com/sampsyo/pyacoustid
Author: Adrian Sampson
......@@ -112,6 +112,18 @@ Description: Chromaprint and Acoustid for Python
Version History
---------------
1.1.5
Fix compatibility with Python 3 in the `submit` function.
Errors in `submit` are now also handled correctly (i.e., they raise an
informative `WebServiceError` instead of a `TypeError`).
1.1.4
Fix an error on versions of the `fpcalc` tool that report the duration as a
fractional number.
1.1.3
Accept `bytearray` objects in addition to other bytes-like types.
1.1.2
Fix a possible crash on Unicode text in Python 2 in a non-Unicode locale.
Look for version "1" of the Chromaprint shared library file.
......
......@@ -104,6 +104,18 @@ used when the Chromaprint library or fpcalc command-line tool cannot be found.
Version History
---------------
1.1.5
Fix compatibility with Python 3 in the `submit` function.
Errors in `submit` are now also handled correctly (i.e., they raise an
informative `WebServiceError` instead of a `TypeError`).
1.1.4
Fix an error on versions of the `fpcalc` tool that report the duration as a
fractional number.
1.1.3
Accept `bytearray` objects in addition to other bytes-like types.
1.1.2
Fix a possible crash on Unicode text in Python 2 in a non-Unicode locale.
Look for version "1" of the Chromaprint shared library file.
......
......@@ -300,7 +300,7 @@ def _fingerprint_file_fpcalc(path, maxlength):
raise FingerprintGenerationError("malformed fpcalc output")
if parts[0] == b'DURATION':
try:
duration = int(parts[1])
duration = float(parts[1])
except ValueError:
raise FingerprintGenerationError("fpcalc duration not numeric")
elif parts[0] == b'FINGERPRINT':
......@@ -366,9 +366,14 @@ def submit(apikey, userkey, data):
for i, d in enumerate(data):
if "duration" not in d or "fingerprint" not in d:
raise FingerprintSubmissionError("missing required parameters")
for k, v in d.iteritems():
for k, v in d.items():
args["%s.%s" % (k, i)] = v
response = _api_request(_get_submit_url(), args)
if response['status'] != 'ok':
raise WebServiceError("status: %s" % data['status'])
if response.get('status') != 'ok':
try:
code = response['error']['code']
message = response['error']['message']
except KeyError:
raise WebServiceError("response: {0}".format(response))
raise WebServiceError("error {0}: {1}".format(code, message))
......@@ -9,11 +9,11 @@ import ctypes
if sys.version_info[0] >= 3:
BUFFER_TYPES = (memoryview,)
BUFFER_TYPES = (memoryview, bytearray,)
elif sys.version_info[1] >= 7:
BUFFER_TYPES = (buffer, memoryview,)
BUFFER_TYPES = (buffer, memoryview, bytearray,)
else:
BUFFER_TYPES = (buffer,)
BUFFER_TYPES = (buffer, bytearray,)
# Find the base library and declare prototypes.
......@@ -24,9 +24,11 @@ def _guess_lib_name():
elif sys.platform == 'win32':
return ('chromaprint.dll', 'libchromaprint.dll')
elif sys.platform == 'cygwin':
return ('libchromaprint.dll.a', 'cygchromaprint-1.dll', 'cygchromaprint-0.dll')
return ('libchromaprint.dll.a', 'cygchromaprint-1.dll',
'cygchromaprint-0.dll')
return ('libchromaprint.so.1', 'libchromaprint.so.0')
for name in _guess_lib_name():
try:
_libchromaprint = ctypes.cdll.LoadLibrary(name)
......@@ -36,6 +38,7 @@ for name in _guess_lib_name():
else:
raise ImportError("couldn't find libchromaprint")
_libchromaprint.chromaprint_get_version.argtypes = ()
_libchromaprint.chromaprint_get_version.restype = ctypes.c_char_p
......@@ -81,6 +84,7 @@ _libchromaprint.chromaprint_dealloc.restype = None
class FingerprintError(Exception):
"""Raised when a call to the underlying library fails."""
def _check(res):
"""Check the result of a library call, raising an error if the call
failed.
......@@ -88,6 +92,7 @@ def _check(res):
if res != 1:
raise FingerprintError()
class Fingerprinter(object):
ALGORITHM_TEST1 = 0
......@@ -134,6 +139,7 @@ class Fingerprinter(object):
_libchromaprint.chromaprint_dealloc(fingerprint_ptr)
return fingerprint
def decode_fingerprint(data, base64=True):
result_ptr = ctypes.POINTER(ctypes.c_int32)()
result_size = ctypes.c_int()
......@@ -146,6 +152,7 @@ def decode_fingerprint(data, base64=True):
_libchromaprint.chromaprint_dealloc(result_ptr)
return result, algorithm.value
def encode_fingerprint(fingerprint, algorithm, base64=True):
fp_array = (ctypes.c_int * len(fingerprint))()
for i in range(len(fingerprint)):
......
Metadata-Version: 1.1
Name: pyacoustid
Version: 1.1.2
Version: 1.1.5
Summary: bindings for Chromaprint acoustic fingerprinting and the Acoustid API
Home-page: https://github.com/sampsyo/pyacoustid
Author: Adrian Sampson
......@@ -112,6 +112,18 @@ Description: Chromaprint and Acoustid for Python
Version History
---------------
1.1.5
Fix compatibility with Python 3 in the `submit` function.
Errors in `submit` are now also handled correctly (i.e., they raise an
informative `WebServiceError` instead of a `TypeError`).
1.1.4
Fix an error on versions of the `fpcalc` tool that report the duration as a
fractional number.
1.1.3
Accept `bytearray` objects in addition to other bytes-like types.
1.1.2
Fix a possible crash on Unicode text in Python 2 in a non-Unicode locale.
Look for version "1" of the Chromaprint shared library file.
......
......@@ -8,5 +8,6 @@ setup.py
pyacoustid.egg-info/PKG-INFO
pyacoustid.egg-info/SOURCES.txt
pyacoustid.egg-info/dependency_links.txt
pyacoustid.egg-info/pbr.json
pyacoustid.egg-info/requires.txt
pyacoustid.egg-info/top_level.txt
\ No newline at end of file
{"is_release": false, "git_version": "0d56b1d"}
\ No newline at end of file
......@@ -31,7 +31,7 @@ def _read(fn):
setup(name='pyacoustid',
version='1.1.2',
version='1.1.5',
description=
'bindings for Chromaprint acoustic fingerprinting and the '
'Acoustid API',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment