mirror of
https://github.com/correl/dejavu.git
synced 2024-11-27 11:09:51 +00:00
revamped testing script
This commit is contained in:
parent
b966225ad4
commit
7cbb894501
2 changed files with 13 additions and 9 deletions
|
@ -4,8 +4,14 @@ import fingerprint
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Dejavu(object):
|
class Dejavu(object):
|
||||||
|
|
||||||
|
SONG_ID = "song_id"
|
||||||
|
SONG_NAME = 'song_name'
|
||||||
|
CONFIDENCE = 'confidence'
|
||||||
|
MATCH_TIME = 'match_time'
|
||||||
|
OFFSET = 'offset'
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
super(Dejavu, self).__init__()
|
super(Dejavu, self).__init__()
|
||||||
|
|
||||||
|
@ -136,18 +142,17 @@ class Dejavu(object):
|
||||||
# extract idenfication
|
# extract idenfication
|
||||||
song = self.db.get_song_by_id(song_id)
|
song = self.db.get_song_by_id(song_id)
|
||||||
if song:
|
if song:
|
||||||
# TODO: Clarifey what `get_song_by_id` should return.
|
# TODO: Clarify what `get_song_by_id` should return.
|
||||||
songname = song.get("song_name", None)
|
songname = song.get(Dejavu.SONG_NAME, None)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# return match info
|
# return match info
|
||||||
song = {
|
song = {
|
||||||
"song_id": song_id,
|
Dejavu.SONG_ID : song_id,
|
||||||
"song_name": songname,
|
Dejavu.SONG_NAME : songname,
|
||||||
"confidence": largest_count,
|
Dejavu.CONFIDENCE : largest_count,
|
||||||
"offset": largest
|
Dejavu.OFFSET : largest }
|
||||||
}
|
|
||||||
|
|
||||||
return song
|
return song
|
||||||
|
|
||||||
|
|
1
test.py
1
test.py
|
@ -9,7 +9,6 @@ from os import listdir
|
||||||
from os.path import isfile, join
|
from os.path import isfile, join
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import matplotlib.animation as animation
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from dejavu.decoder import path_to_songname
|
from dejavu.decoder import path_to_songname
|
||||||
import ast
|
import ast
|
||||||
|
|
Loading…
Reference in a new issue