eyeD3でMP3ファイルのタグ情報を取得する。
eyeD3でMP3ファイルのアーティスト名などのタグ情報を取得してみる。
1.インストール
pip install eyeD3
2.実行例
(1) コマンドラインから
$ eyeD3 'Last Christmas.mp3' 01 Last Christmas.mp3 [ 8.18 MB ] ------------------------------------------------------------------------------- Time: 03:29 MPEG1, Layer III [ 320 kb/s @ 44100 Hz - Stereo ] ------------------------------------------------------------------------------- ID3 v2.3: title: Last Christmas artist: Taylor Swift album: Holiday Collection recording date: 2007 track: 1 genre: Country (id 2) OTHER Image: [Size: 176995 bytes] [Type: image/png] Description: -------------------------------------------------------------------------------
(2) Pythonから
$ python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import eyed3 >>> audiofile = eyed3.load("Last Christmas.mp3') >>> print audiofile.tag.artist.encode('utf-8') Taylor Swift >>> print audiofile.tag.album.encode('utf-8') Holiday Collection >>> print audiofile.tag.title Last Christmas >>> print audiofile.tag.track_num (1, None)