diff --git a/dejavu/control.py b/dejavu/control.py index 2fdac40..4f6edce 100644 --- a/dejavu/control.py +++ b/dejavu/control.py @@ -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 diff --git a/dejavu/convert.py b/dejavu/convert.py index 77afcef..c13e0a1 100644 --- a/dejavu/convert.py +++ b/dejavu/convert.py @@ -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)