From dad98961f4a52da61f2e224cef615813b8a65f86 Mon Sep 17 00:00:00 2001 From: Will Drevo Date: Wed, 14 Jan 2015 20:32:49 -0500 Subject: [PATCH] Offset cast to int, return is valid JSON. Fixes #67 --- dejavu/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dejavu/__init__.py b/dejavu/__init__.py index 66d9c92..6194cec 100755 --- a/dejavu/__init__.py +++ b/dejavu/__init__.py @@ -156,7 +156,7 @@ class Dejavu(object): Dejavu.SONG_ID: song_id, Dejavu.SONG_NAME: songname, Dejavu.CONFIDENCE: largest_count, - Dejavu.OFFSET: largest, + Dejavu.OFFSET: int(largest), Dejavu.OFFSET_SECS: nseconds } @@ -176,14 +176,11 @@ def _fingerprint_worker(filename, limit=None, song_name=None): pass songname, extension = os.path.splitext(os.path.basename(filename)) - song_name = song_name or songname - channels, Fs = decoder.read(filename, limit) - result = set() - channel_amount = len(channels) + for channeln, channel in enumerate(channels): # TODO: Remove prints or change them into optional logging. print("Fingerprinting channel %d/%d for %s" % (channeln + 1, @@ -192,7 +189,6 @@ def _fingerprint_worker(filename, limit=None, song_name=None): hashes = fingerprint.fingerprint(channel, Fs=Fs) print("Finished channel %d/%d for %s" % (channeln + 1, channel_amount, filename)) - result |= set(hashes) return song_name, result