最近又想折腾点什么了……

一直很垂涎AirTunes(Wireless Speaker)的功能,可以躺在床上用iPhone无线放音乐。实现AirTunes的最简单的方法就是买个Airport无线AP,接个音箱就好了。可是我的音箱是接在服务器上的,平时放音乐都是ssh到服务器,用mpg123放mp3或者ogg123放flac。用iPhone虽然也能用issh来放歌,但一直想要个GUI,弄了个mt-daapd(现名firefly media server,就是iTunes Music Server,很多NAS上都用的这个),试了些webGUI,都不是很理想。

直到我发现了forked-daapd,官方的介绍是A re-write of the firefly media server。它的最大特点是支持和iOS的remote配对,这样一来,iPhone就变成了一个完美的UI,来控制服务器放歌。

兴奋的装上了debian源上的版本,0.12,和iPhone Remote配对的时候却怎么也没反应。Google了一下发现只支持1.x版的Remote,2.x版的Remote的支持虽然已经修正,但是貌似并没有release,没办法,只好去自己编trunk版。

用Git clone了一份代码下来,看看INSTALL,要好多东西,一一装好以后,发现ffmpeg版本不够……又去重编ffmpeg,折腾了好久终于编完装好了forked daapd 0.18版本。

System-specific requirements:
- Linux:
+ glibc 2.9+ (for signalfd)
+ libasound (ALSA sound support - or you can use OSS4)
- FreeBSD:
+ OSS4 sound support
+ libiconv
Tools:
- pkg-config
- gperf 3.x
from <http://www.gnu.org/software/gperf/>
Libraries:
- libantlr3c (ANTLR3 C runtime, version 3.2 for tarball builds)
from <http://www.antlr.org/download/C>
- Avahi client libraries (avahi-client), 0.6.24 minimum
from <http://avahi.org/>
- sqlite3 3.5.0+ with unlock notify API enabled (read below)
from <http://sqlite.org/download.html>
- libav 0.6+/0.7+ (or ffmpeg 0.5.1+)
from <http://libav.org/releases/>
- libconfuse
from <http://www.nongnu.org/confuse/>
- libevent 1.4+
from <http://www.monkey.org/~provos/libevent/>
- libavl
/!\ Read below
- MiniXML (aka mxml or libmxml)
from <http://minixml.org/software.php>
- gcrypt 1.2.0+
from <http://gnupg.org/download/index.en.html#libgcrypt>
- zlib
from <http://zlib.net/>
- libunistring 0.9.3+
from <http://www.gnu.org/software/libunistring/#downloading>
- libflac (optional - FLAC support)
from <http://flac.sourceforge.net/download.html>
- taglib (optional - Musepack support)
from <http://developer.kde.org/~wheeler/taglib.html>
- libplist 0.16+ (optional - iTunes XML support)
from <http://github.com/JonathanBeck/libplist/downloads>

配对完后,设定好/etc/forked-daapd.conf里的音乐目录,重启下服务就开始扫描了。打开iPhone的remote,选择Add New Library,然后在服务器音乐目录下放个iPhone.remote,第一行写iPhone的名字,第二行写那remote的四位密码。就自动配好对了。remote上显示出了服务器上的library,放一下,放不了,原来没把daapd用户加到audio组里……加入后问题解决。

看看效果: