mirror of
https://github.com/correl/dejavu.git
synced 2024-11-23 11:09:52 +00:00
fixes #4, now wav files storage is optional
This commit is contained in:
parent
f918b6b7e0
commit
0b36781ccd
1 changed files with 9 additions and 4 deletions
|
@ -34,7 +34,7 @@ class Dejavu():
|
|||
"""
|
||||
return [lst[i::n] for i in xrange(n)]
|
||||
|
||||
def fingerprint(self, path, output, extensions, nprocesses):
|
||||
def fingerprint(self, path, output, extensions, nprocesses, keep_wav=False):
|
||||
|
||||
# convert files, shuffle order
|
||||
files = self.converter.find_files(path, extensions)
|
||||
|
@ -53,7 +53,7 @@ class Dejavu():
|
|||
self.config.get(SQLDatabase.CONNECTION, SQLDatabase.KEY_DATABASE))
|
||||
|
||||
# create process and start it
|
||||
p = Process(target=self.fingerprint_worker, args=(files_split[i], sql_connection, output))
|
||||
p = Process(target=self.fingerprint_worker, args=(files_split[i], sql_connection, output, keep_wav))
|
||||
p.start()
|
||||
processes.append(p)
|
||||
|
||||
|
@ -66,7 +66,7 @@ class Dejavu():
|
|||
# TODO: need a more performant query in database.py for the
|
||||
#self.fingerprinter.db.delete_orphans()
|
||||
|
||||
def fingerprint_worker(self, files, sql_connection, output):
|
||||
def fingerprint_worker(self, files, sql_connection, output, keep_wav):
|
||||
|
||||
for filename, extension in files:
|
||||
|
||||
|
@ -89,6 +89,11 @@ class Dejavu():
|
|||
print "-> Fingerprinting channel %d of song %s..." % (c+1, song_name)
|
||||
self.fingerprinter.fingerprint(channel, wavout_path, song_id, c+1)
|
||||
|
||||
# remove wav file if not required
|
||||
if not keep_wav:
|
||||
print "removing ", wavout_path
|
||||
os.unlink(wavout_path)
|
||||
|
||||
# only after done fingerprinting do confirm
|
||||
sql_connection.set_song_fingerprinted(song_id)
|
||||
|
||||
|
@ -104,4 +109,4 @@ class Dejavu():
|
|||
|
||||
for channel in range(nchannels):
|
||||
channels.append(frames[:, channel])
|
||||
return channels
|
||||
return channels
|
||||
|
|
Loading…
Reference in a new issue