Skip to content
Snippets Groups Projects
Commit 8f1e991c authored by ale's avatar ale
Browse files

Merge branch 'master' of https://git.autistici.org/djrandom

parents 2f19b8d0 0675b44d
Branches
No related tags found
No related merge requests found
......@@ -265,6 +265,7 @@ class PlayLog(Base):
class SearchLog(Base):
__tablename__ = 'searchlog'
__table_args__ = {'mysql_charset': 'utf8'}
id = Column(Integer(), primary_key=True)
userid = Column(String(40), index=True)
......
......@@ -14,12 +14,21 @@ from djrandom.mood import mood
log = logging.getLogger(__name__)
def vector_from_file(path):
ln = os.path.join('/tmp', '__analysis_%s.mp3' % os.path.basename(path))
os.symlink(path, ln)
try:
return mood.vector_from_file(ln)
finally:
os.unlink(ln)
class FeatureExtractor(processor.Processor):
def process(self, mp3):
log.info('extracting features from %s' % mp3.sha1)
try:
timbre_vector = mood.vector_from_file(mp3.path)
timbre_vector = vector_from_file(mp3.path)
except Exception, e:
log.error('error processing %s: %s' % (mp3.sha1, e))
return
......
......@@ -104,8 +104,8 @@ string vector_from_file(const string& filename)
// Shift the start over so that the duration is in the middle
mrs_natural start = (slength - numsamps)/2;
fnet->updctrl("SoundFileSource/src/mrs_natural/start", start);
fnet->updctrl("SoundFileSource/src/mrs_natural/duration", numsamps);
fnet->updctrl("SoundFileSource/src/mrs_natural/pos", start);
fnet->updctrl("SoundFileSource/src/mrs_natural/onSamples", numsamps);
// ----------------- Accumulator ---------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment