diff --git a/dejavu/base_classes/common_database.py b/dejavu/base_classes/common_database.py index 699385e..8b6f2c1 100644 --- a/dejavu/base_classes/common_database.py +++ b/dejavu/base_classes/common_database.py @@ -69,7 +69,6 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta): with self.cursor() as cur: cur.execute(self.SELECT_NUM_FINGERPRINTS) count = cur.fetchone()[0] if cur.rowcount != 0 else 0 - cur.close() return count @@ -100,16 +99,16 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta): cur.execute(self.SELECT_SONG, (sid,)) return cur.fetchone() - def insert(self, hash, sid, offset): + def insert(self, fingerprint, sid, offset): """ Inserts a single fingerprint into the database. - hash: Part of a sha1 hash, in hexadecimal format + fingerprint: Part of a sha1 hash, in hexadecimal format sid: Song identifier this fingerprint is off - offset: The offset this hash is from + offset: The offset this fingerprint is from """ with self.cursor() as cur: - cur.execute(self.INSERT_FINGERPRINT, (hash, sid, offset)) + cur.execute(self.INSERT_FINGERPRINT, (fingerprint, sid, offset)) @abc.abstractmethod def insert_song(self, song_name): @@ -124,9 +123,9 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta): def query(self, fingerprint): """ Returns all matching fingerprint entries associated with - the given hash as parameter. + the given fingerprint as parameter. - hash: Part of a sha1 hash, in hexadecimal format + fingerprint: Part of a sha1 hash, in hexadecimal format """ if fingerprint: with self.cursor() as cur: diff --git a/dejavu/logic/fingerprint.py b/dejavu/logic/fingerprint.py index 0653965..46729f6 100755 --- a/dejavu/logic/fingerprint.py +++ b/dejavu/logic/fingerprint.py @@ -87,7 +87,7 @@ def get_2D_peaks(arr2D, plot=False, amp_min=DEFAULT_AMP_MIN): def generate_hashes(peaks, fan_value=DEFAULT_FAN_VALUE): """ Hash list structure: - sha1_hash[0:20] time_offset + sha1_hash[0:FINGERPRINT_REDUCTION] time_offset [(e05b341a9b77a51fd26, 32), ... ] """ if PEAK_SORT: