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.database import SQLDatabase
|
||||||
from dejavu.convert import Converter
|
import dejavu.decode as decoder
|
||||||
import fingerprint
|
import fingerprint
|
||||||
from scipy.io import wavfile
|
from scipy.io import wavfile
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
@ -16,8 +16,6 @@ class Dejavu(object):
|
||||||
# initialize db
|
# initialize db
|
||||||
self.db = SQLDatabase(**config.get("database", {}))
|
self.db = SQLDatabase(**config.get("database", {}))
|
||||||
|
|
||||||
# create components
|
|
||||||
self.converter = Converter()
|
|
||||||
#self.fingerprinter = Fingerprinter(self.config)
|
#self.fingerprinter = Fingerprinter(self.config)
|
||||||
self.db.setup()
|
self.db.setup()
|
||||||
|
|
||||||
|
@ -41,7 +39,7 @@ class Dejavu(object):
|
||||||
def do_fingerprint(self, path, output, extensions, nprocesses):
|
def do_fingerprint(self, path, output, extensions, nprocesses):
|
||||||
|
|
||||||
# convert files, shuffle order
|
# convert files, shuffle order
|
||||||
files = self.converter.find_files(path, extensions)
|
files = decoder.find_files(path, extensions)
|
||||||
random.shuffle(files)
|
random.shuffle(files)
|
||||||
files_split = self.chunkify(files, nprocesses)
|
files_split = self.chunkify(files, nprocesses)
|
||||||
|
|
||||||
|
@ -74,14 +72,11 @@ class Dejavu(object):
|
||||||
print("-> Already fingerprinted, continuing...")
|
print("-> Already fingerprinted, continuing...")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# convert to WAV
|
channels, Fs = decoder.read(filename)
|
||||||
wavout_path = self.converter.convert(filename, extension, Converter.WAV, output, song_name)
|
|
||||||
|
|
||||||
# insert song name into database
|
# insert song name into database
|
||||||
song_id = sql_connection.insert_song(song_name)
|
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)):
|
for c in range(len(channels)):
|
||||||
channel = channels[c]
|
channel = channels[c]
|
||||||
print "-> Fingerprinting channel %d of song %s..." % (c+1, song_name)
|
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
|
of the file by specifying the `limit` parameter. This is the amount of
|
||||||
seconds from the start of the file.
|
seconds from the start of the file.
|
||||||
|
|
||||||
returns: (samplerate, channels)
|
returns: (channels, samplerate)
|
||||||
"""
|
"""
|
||||||
audiofile = AudioSegment.from_file(filename)
|
audiofile = AudioSegment.from_file(filename)
|
||||||
|
|
||||||
|
@ -37,4 +37,4 @@ def read(filename, limit=None):
|
||||||
for chn in xrange(audiofile.channels):
|
for chn in xrange(audiofile.channels):
|
||||||
channels.append(data[chn::audiofile.channels])
|
channels.append(data[chn::audiofile.channels])
|
||||||
|
|
||||||
return audiofile.frame_rate, channels
|
return channels, audiofile.frame_rate
|
||||||
|
|
Loading…
Reference in a new issue