mirror of
https://github.com/correl/dejavu.git
synced 2024-12-29 11:09:26 +00:00
fixes #3, now song_name column in database has the full path
This commit is contained in:
parent
0b36781ccd
commit
6a4d386736
2 changed files with 6 additions and 8 deletions
|
@ -69,24 +69,22 @@ class Dejavu():
|
|||
def fingerprint_worker(self, files, sql_connection, output, keep_wav):
|
||||
|
||||
for filename, extension in files:
|
||||
|
||||
# if there are already fingerprints in database, don't re-fingerprint or convert
|
||||
song_name = os.path.basename(filename).split(".")[0]
|
||||
if song_name in self.songnames_set:
|
||||
if filename in self.songnames_set:
|
||||
print "-> Already fingerprinted, continuing..."
|
||||
continue
|
||||
|
||||
# convert to WAV
|
||||
wavout_path = self.converter.convert(filename, extension, Converter.WAV, output, song_name)
|
||||
wavout_path = self.converter.convert(filename, extension, Converter.WAV, output)
|
||||
|
||||
# insert song name into database
|
||||
song_id = sql_connection.insert_song(song_name)
|
||||
song_id = sql_connection.insert_song(filename)
|
||||
|
||||
# for each channel perform FFT analysis and fingerprinting
|
||||
channels = self.extract_channels(wavout_path)
|
||||
for c in range(len(channels)):
|
||||
channel = channels[c]
|
||||
print "-> Fingerprinting channel %d of song %s..." % (c+1, song_name)
|
||||
print "-> Fingerprinting channel %d of song %s..." % (c+1, filename)
|
||||
self.fingerprinter.fingerprint(channel, wavout_path, song_id, c+1)
|
||||
|
||||
# remove wav file if not required
|
||||
|
|
|
@ -30,8 +30,8 @@ class Converter():
|
|||
filepaths.append((renamed, extension))
|
||||
return filepaths
|
||||
|
||||
def convert(self, orig_path, from_format, to_format, output_folder, song_name):
|
||||
|
||||
def convert(self, orig_path, from_format, to_format, output_folder):
|
||||
path, song_name = os.path.split(orig_path)
|
||||
# start conversion
|
||||
self.ensure_folder(output_folder)
|
||||
print "-> Now converting: %s from %s format to %s format..." % (song_name, from_format, to_format)
|
||||
|
|
Loading…
Reference in a new issue