alexrecarey / dejavu

Audio fingerprinting and recognition in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dejavu

Purpose

This fork attempts to:

  • [✔️] Fix bugs (fixes critical numpy one).
  • [✔️] Use SQLAlchemy to support PostgreSQL, SQLite3 DBs as well.
  • [✔️] Use Pipenv to allow db credentials via .env file
  • [✔️] Support both Python3 and Python2.
  • [WIP] Use the logging module so as to not litter any user's application with prints.
  • [✔️] Reformat code using YAPF (Facebook)

Usage

  1. Install directly from this repo:
pip install -e git+https://github.com/bcollazo/dejavu@v1.2#egg=PyDejavu
  1. Import and use:
from dejavu import Dejavu
from dejavu.recognize import FileRecognizer

djv = Dejavu(dburl='sqlite://')
djv.fingerprint_directory('~/Music')
song = djv.recognize(FileRecognizer, 'mp3/Dura--Daddy-Yankee.mp3')
print(song)
  1. Can also be used as a CLI tool:
export DATABASE_URL=mysql+mysqlconnector://bryan:password@localhost/dejavu
python dejavu.py --fingerprint ~/Music mp3 --limit 30
python dejavu.py --recognize mic 10
python dejavu.py --recognize file sometrack.mp3

You can keep the database url saved in an .env file and use pipenv. As well as specify it via the --dburl command line argument.

Migrating from worldveil/dejavu

If you already have a live database that used to follow worldveil/dejavu database structure, you'll have to migrate your database by renaming:

  • song_id to id
  • song_name to name

in the songs table.

About

Audio fingerprinting and recognition in Python

License:MIT License


Languages

Language:Python 98.6%Language:Shell 1.4%