mirror of
https://github.com/correl/dejavu.git
synced 2024-11-23 11:09:52 +00:00
updated docstring
This commit is contained in:
parent
b96f7e6970
commit
59428922e5
2 changed files with 7 additions and 8 deletions
|
@ -69,7 +69,6 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta):
|
||||||
with self.cursor() as cur:
|
with self.cursor() as cur:
|
||||||
cur.execute(self.SELECT_NUM_FINGERPRINTS)
|
cur.execute(self.SELECT_NUM_FINGERPRINTS)
|
||||||
count = cur.fetchone()[0] if cur.rowcount != 0 else 0
|
count = cur.fetchone()[0] if cur.rowcount != 0 else 0
|
||||||
cur.close()
|
|
||||||
|
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
@ -100,16 +99,16 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta):
|
||||||
cur.execute(self.SELECT_SONG, (sid,))
|
cur.execute(self.SELECT_SONG, (sid,))
|
||||||
return cur.fetchone()
|
return cur.fetchone()
|
||||||
|
|
||||||
def insert(self, hash, sid, offset):
|
def insert(self, fingerprint, sid, offset):
|
||||||
"""
|
"""
|
||||||
Inserts a single fingerprint into the database.
|
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
|
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:
|
with self.cursor() as cur:
|
||||||
cur.execute(self.INSERT_FINGERPRINT, (hash, sid, offset))
|
cur.execute(self.INSERT_FINGERPRINT, (fingerprint, sid, offset))
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def insert_song(self, song_name):
|
def insert_song(self, song_name):
|
||||||
|
@ -124,9 +123,9 @@ class CommonDatabase(BaseDatabase, metaclass=abc.ABCMeta):
|
||||||
def query(self, fingerprint):
|
def query(self, fingerprint):
|
||||||
"""
|
"""
|
||||||
Returns all matching fingerprint entries associated with
|
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:
|
if fingerprint:
|
||||||
with self.cursor() as cur:
|
with self.cursor() as cur:
|
||||||
|
|
|
@ -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):
|
def generate_hashes(peaks, fan_value=DEFAULT_FAN_VALUE):
|
||||||
"""
|
"""
|
||||||
Hash list structure:
|
Hash list structure:
|
||||||
sha1_hash[0:20] time_offset
|
sha1_hash[0:FINGERPRINT_REDUCTION] time_offset
|
||||||
[(e05b341a9b77a51fd26, 32), ... ]
|
[(e05b341a9b77a51fd26, 32), ... ]
|
||||||
"""
|
"""
|
||||||
if PEAK_SORT:
|
if PEAK_SORT:
|
||||||
|
|
Loading…
Reference in a new issue