mirror of
https://github.com/correl/dejavu.git
synced 2024-11-23 19:19:53 +00:00
Offset cast to int, return is valid JSON. Fixes #67
This commit is contained in:
parent
801b692f74
commit
dad98961f4
1 changed files with 2 additions and 6 deletions
|
@ -156,7 +156,7 @@ class Dejavu(object):
|
||||||
Dejavu.SONG_ID: song_id,
|
Dejavu.SONG_ID: song_id,
|
||||||
Dejavu.SONG_NAME: songname,
|
Dejavu.SONG_NAME: songname,
|
||||||
Dejavu.CONFIDENCE: largest_count,
|
Dejavu.CONFIDENCE: largest_count,
|
||||||
Dejavu.OFFSET: largest,
|
Dejavu.OFFSET: int(largest),
|
||||||
Dejavu.OFFSET_SECS: nseconds
|
Dejavu.OFFSET_SECS: nseconds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,14 +176,11 @@ def _fingerprint_worker(filename, limit=None, song_name=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
songname, extension = os.path.splitext(os.path.basename(filename))
|
songname, extension = os.path.splitext(os.path.basename(filename))
|
||||||
|
|
||||||
song_name = song_name or songname
|
song_name = song_name or songname
|
||||||
|
|
||||||
channels, Fs = decoder.read(filename, limit)
|
channels, Fs = decoder.read(filename, limit)
|
||||||
|
|
||||||
result = set()
|
result = set()
|
||||||
|
|
||||||
channel_amount = len(channels)
|
channel_amount = len(channels)
|
||||||
|
|
||||||
for channeln, channel in enumerate(channels):
|
for channeln, channel in enumerate(channels):
|
||||||
# TODO: Remove prints or change them into optional logging.
|
# TODO: Remove prints or change them into optional logging.
|
||||||
print("Fingerprinting channel %d/%d for %s" % (channeln + 1,
|
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)
|
hashes = fingerprint.fingerprint(channel, Fs=Fs)
|
||||||
print("Finished channel %d/%d for %s" % (channeln + 1, channel_amount,
|
print("Finished channel %d/%d for %s" % (channeln + 1, channel_amount,
|
||||||
filename))
|
filename))
|
||||||
|
|
||||||
result |= set(hashes)
|
result |= set(hashes)
|
||||||
|
|
||||||
return song_name, result
|
return song_name, result
|
||||||
|
|
Loading…
Reference in a new issue