mirror of
https://github.com/correl/dejavu.git
synced 2024-11-23 19:19:53 +00:00
Fixed any references to old converter to use the new functions.
- Reversed return values in decode.read
This commit is contained in:
parent
8a7358d426
commit
7895bae23e
2 changed files with 5 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
from dejavu.database import SQLDatabase
|
||||
from dejavu.convert import Converter
|
||||
import dejavu.decode as decoder
|
||||
import fingerprint
|
||||
from scipy.io import wavfile
|
||||
from multiprocessing import Process
|
||||
|
@ -16,8 +16,6 @@ class Dejavu(object):
|
|||
# initialize db
|
||||
self.db = SQLDatabase(**config.get("database", {}))
|
||||
|
||||
# create components
|
||||
self.converter = Converter()
|
||||
#self.fingerprinter = Fingerprinter(self.config)
|
||||
self.db.setup()
|
||||
|
||||
|
@ -41,7 +39,7 @@ class Dejavu(object):
|
|||
def do_fingerprint(self, path, output, extensions, nprocesses):
|
||||
|
||||
# convert files, shuffle order
|
||||
files = self.converter.find_files(path, extensions)
|
||||
files = decoder.find_files(path, extensions)
|
||||
random.shuffle(files)
|
||||
files_split = self.chunkify(files, nprocesses)
|
||||
|
||||
|
@ -74,14 +72,11 @@ class Dejavu(object):
|
|||
print("-> Already fingerprinted, continuing...")
|
||||
continue
|
||||
|
||||
# convert to WAV
|
||||
wavout_path = self.converter.convert(filename, extension, Converter.WAV, output, song_name)
|
||||
channels, Fs = decoder.read(filename)
|
||||
|
||||
# insert song name into database
|
||||
song_id = sql_connection.insert_song(song_name)
|
||||
|
||||
# for each channel perform FFT analysis and fingerprinting
|
||||
channels, Fs = 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)
|
||||
|
|
|
@ -24,7 +24,7 @@ def read(filename, limit=None):
|
|||
of the file by specifying the `limit` parameter. This is the amount of
|
||||
seconds from the start of the file.
|
||||
|
||||
returns: (samplerate, channels)
|
||||
returns: (channels, samplerate)
|
||||
"""
|
||||
audiofile = AudioSegment.from_file(filename)
|
||||
|
||||
|
@ -37,4 +37,4 @@ def read(filename, limit=None):
|
|||
for chn in xrange(audiofile.channels):
|
||||
channels.append(data[chn::audiofile.channels])
|
||||
|
||||
return audiofile.frame_rate, channels
|
||||
return channels, audiofile.frame_rate
|
||||
|
|
Loading…
Reference in a new issue