码迷,mamicode.com
首页 > 其他好文 > 详细

AcoustID音频指纹环境配置--Server

时间:2016-08-01 17:19:11      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

配置AcoustID开源项目的Server端,包括两部分内容:acoustid-server和acoustid-index。

分别参考https://bitbucket.org/acoustid/acoustid-server

           https://bitbucket.org/acoustid/acoustid-index

 

###acoustid-server配置###

#下载源代码,安装依赖包

git clone https://bitbucket.org/acoustid/acoustid-serer.git
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install redis-server
sudo apt-get install python python-dev python-virtualenv
sudo apt-get install postgresql-9.1-acoustid

#配置Python虚拟环境

virtualenv e
source e/bin/activate
pip insatll -r requirements.txt

#配置postgresql数据库

sudo -u postgres createuser acoustid
sudo -u postgres createdb -O acoustid acoustid
#这里分别创建了名称为acoustid的用户,以及名称为acoustid的数据库
psql -U postgres
alter user acoustid with password ‘yourpassword‘;
#登录postgresql,修改acoustid密码

#修改配置文件

cp acoustid.conf.dist acoustid.conf
vim acoustid.conf 
#修改配置文件为上步修改的密码,password=yourpassword

#在数据库中添加扩展应用

sudo -u postgres psql acoustid -c ‘CREATE EXTENSION intarray‘;
sudo -u postgres psql acoustid -c ‘CREATE EXTENSION pgcrypto‘;
sudo -u postgres psql acoustid -c ‘CREATE EXTENSION acoustid‘;

#创建数据库的表结构

./run_psql.sh < sql/CreateTables.sql
./run_psql.sh < sql/CreatePrimaryKeys.sql
./run_psql.sh < sql/CreateFKConstraints.sql
./run_psql.sh < sql/CreateIndexes.sql

#测试运行

./run_web.sh --host=0.0.0.0

#如运行无误,可进行下一步配置

###acoustid-index配置###

#下载源代码,安装 

git clone https://bitbucket.org/acoustid/acoustid-index.git
cmake .
make && make install

#测试运行

./fpi-server

###总的Server端环境测试###

#分别开启acoustid-server和acoustid-index服务

./run_web.sh --api
./fpi-server

#开启服务后,可以通过网页访问Server端的api接口,也就是acoustid的web-service。URL为:http://127.0.0.1:5000/api/ws/v2/lookup?client=XXX&duration=XXX&fingerprint=***

其中,http://127.0.0.1:5000/api/ws/v2/为接口前缀,之后的lookup和submit分别调用查询和提交处理函数,client、duration、fingerprint则是对应的参数。详细可以查看acoustid-server/acoustid/server.py。client对应的参数可以自行在postgresql数据库acoustid的account表中添加,duration和fingerprint可以用Chromaprint通过计算音频文件的指纹信息得到。

为了使submit提交到数据库中,还需修改acoustid-server/acoustid/api/v2/__init__.py中的SubmitHandler函数。

lookup查询的信息也可以通过修改acoustid-server/acoustid/api/v2/__init__.py中的LookupHandler函数调整。

  

  

  

AcoustID音频指纹环境配置--Server

标签:

原文地址:http://www.cnblogs.com/nkis-yu/p/5726344.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!