From 7cbb8945010abc320e74f0ffd6039b076d56ee31 Mon Sep 17 00:00:00 2001 From: Will Drevo Date: Wed, 2 Jul 2014 23:49:38 -0400 Subject: [PATCH] revamped testing script --- dejavu/__init__.py | 21 +++++++++++++-------- test.py | 1 - 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dejavu/__init__.py b/dejavu/__init__.py index b18ad2e..359063c 100755 --- a/dejavu/__init__.py +++ b/dejavu/__init__.py @@ -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 diff --git a/test.py b/test.py index cafc4ff..b9e47a1 100755 --- a/test.py +++ b/test.py @@ -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