revamped testing script

This commit is contained in:
Will Drevo 2014-07-02 23:49:38 -04:00
parent b966225ad4
commit 7cbb894501
2 changed files with 13 additions and 9 deletions

View file

@ -4,8 +4,14 @@ import fingerprint
import multiprocessing
import os
class Dejavu(object):
SONG_ID = "song_id"
SONG_NAME = 'song_name'
CONFIDENCE = 'confidence'
MATCH_TIME = 'match_time'
OFFSET = 'offset'
def __init__(self, config):
super(Dejavu, self).__init__()
@ -136,18 +142,17 @@ class Dejavu(object):
# extract idenfication
song = self.db.get_song_by_id(song_id)
if song:
# TODO: Clarifey what `get_song_by_id` should return.
songname = song.get("song_name", None)
# TODO: Clarify what `get_song_by_id` should return.
songname = song.get(Dejavu.SONG_NAME, None)
else:
return None
# return match info
song = {
"song_id": song_id,
"song_name": songname,
"confidence": largest_count,
"offset": largest
}
Dejavu.SONG_ID : song_id,
Dejavu.SONG_NAME : songname,
Dejavu.CONFIDENCE : largest_count,
Dejavu.OFFSET : largest }
return song

View file

@ -9,7 +9,6 @@ from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from optparse import OptionParser
from dejavu.decoder import path_to_songname
import ast