Debian GNU/LinuxでiTunes Serverを作るメモ
超絶簡単なiTunesサーバーの作り方。
日本語のタグはUTF-8だったらそのままで使えます。
- aptitude install mt-daapdみたいな感じでmt-daapdをダウンロードしてインスコ。
- ブラウザで http://localhost:3689/ の設定画面を開く。
- mp3のあるディレクトリを指定してスキャンする。
- iTunesなりamaroKなりで聞く。
以下はとっても古いので参考にしないでください。
iPod Shuffle同盟が欲しくなったので調べてみた。
参考資料
MYCOM PCWEBの 「OS X ハッキング! 第100回 LinuxをiTunesサーバに仕立てる」 と、 「LinuxをiTunesのサーバにする」 を参考にしました。
インストール
それによるとDAAPとRendezvousが必要らしいです。 DAAPはdaapdとかmt-daapdってヤツで、Rendezvousはmdnsresponderだそうです。
ってことで探してみた。
~# apt-cache search daap daapd - Serves music files using the Apple DAA protocol libopendaap-dev - enables applications to use iTunes music shares- devel libopendaap0 - enables applications to use iTunes music shares- library tunesbrowser - music player for iTunes shares$(0!;(B opendaap frontend
へー。 tunesbrowserなんてのもあるんだ。 でも、tunesbrowser関連は本家じゃなくて rarewaresのヤツで おまけに古いのでパスだな。
それはさておき、とりあえず必要なのはdaapdですな。 ちなみに本家にあるので通常のapt-lineでおけーです。 sidだけどね。
あと今回使わないけど、mt-daapdのdebianパッケージは 本家のページか、 freevoのapt-lineの中にあります。
~# apt-cache showpkg daapd Package: daapd Versions: 0.2.3d-4(/var/lib/apt/lists/ftp1.debian.or.jp_debian_dists_unstable_main_binary-i386_Packages) Reverse Depends: Dependencies: 0.2.3d-4 - libc6 (2 2.3.2.ds1-4) libgcc1 (2 1:3.4.1-3) libhowl0 (0 (null)) libid3tag0 (2 0.15.0b) libstdc++5 (2 1:3.3.4-1) zlib1g (2 1:1.2.1) mdnsresponder (0 (null)) Provides: 0.2.3d-4 - Reverse Provides:
お、daapdを入れるだけで必要な物が全部揃うじゃん。
てなわけで
~# apt-get install -t unstable daapd
で終了。 -t unstableは、インストールするマシンはpinでtestingで止めているんだけど、 daapdはunstableにしかないから指定してます。 もちろん、apt-lineにunstableを入れておかなければ指定してもインストールはできません。
まあ、この辺は「Debian GNU/Linux スレッドテンプレ」の aptとその周辺を見て試行錯誤するとよいかも。 責任は持ちませんけど。
あと関係ありそうなhowl-utilsとlibhowl-docも入れておいたほうがいいかな。
設定
mdnsresponderは、/etc/mdnsresponder/mDNSResponder.confがあるので、 「LinuxをiTunesのサーバにする」を参考に
iTunes Server _daap._tcp. none 3689
という行を追加。
daapdは/etc/daapd.confというのがあるので、 サーバー名(ServerName)とデータベース名(DBName)と共有ディレクトリ(Root)を変更する。
# Most daapd settings can be overridden by command line switches; see # 'man daapd' for details. # # Port to listen on (3689 is the IANA assigned daapd port) Port 3689 # # Name to advertise server as ServerName fuga ←ここと # # Name of database (the effect of this is undocumented) DBName fuga ←ここと # # A password is optional, but if defined, the server will require # clients to present it. Password # # The root of the shared music tree Root /usr/local/mp3 ←ディレクトリ名を変える。 # # A cache file is optional, but it makes server startup much faster # after the first time. It must be writable by the daapd user. Cache /var/cache/daapd/daapd.cache # # Timescan controls the way daapd estimates the duration of variable # bitrate audio files; see man daapd for details. Timescan 2 # # How often to poll filesystem for new audio files (seconds) Rescan 60
で、mdnsresponderとdaapdを再起動。
~# /etc/init.d/mdnsresponder restart ~# /etc/init.d/daapd restart
すると…。 iTunesにサーバーが出たー。
が。 サーバーは見えたけど曲が見えなーい!
ということで続く。
原因判明
うちの音楽ファイルは音楽ファイル専用のユーザー・グループになるのを忘れてた。orz
ってことで、Debianパッケージのdaapdはdaapd専用ユーザーを作ってくれるのだけど、 ユーザーdaapdを音楽ファイルのグループに登録して無事読んでくれましたとさ。
文字化け
音楽ファイルは読めたのはいいけど、 日本語タグが化けてます。
なんでだろうな。 id3のバージョンはv2.4でUTF-8なんだけど。 うーむ。
というわけで、まだ続く。
文字化けその2
ソースを見てたらdb.ccのgetId3TextFrameで、元の文字コードをUCS-4と仮定して UTF-8に変換しているところを発見。 しかし、原因がわかってもC++を知らないのでコードを書けないのであった。orz
さあ、どうする。
Keyword(s):[linux] [debian] [itunes] [ipod]
References:[Linux Tips]