使用命令行工具从ID3标签获取特定字段?

时间:2010-12-27 13:32:06

标签: linux shell mp3 id3

我正在寻找一种让我从mp3文件中获取ID3标签的特定字段的方法。

到目前为止,我所有的工具都找到了所有字段,并且还将它们格式化为“更容易阅读”。我只需要一些字段,格式不同(artist \ talbum \ ttitle \ n)用于报告目的。

有没有这样的工具?我希望能让我从ID3v1和ID3v2单独输出值的工具。

2 个答案:

答案 0 :(得分:8)

id3v2 -R听起来像是你想要的。 Debian软件包名称为id3v2,上游为http://id3v2.sourceforge.net/

从联系手册:

   -R, --list-rfc822
          Lists using an rfc822-style format for output

示例:

$ id3v2 -R 365-Days-Project-04-26-sprinkle-leland-w-the-great-stalacpipe-organ.mp3 

Filename: 365-Days-Project-04-26-sprinkle-leland-w-the-great-stalacpipe-organ.mp3
TALB: Released independently through Luray Caverns
TPE1: Leland W. Sprinkle
TIT2: The Great Stalacpipe Organ
COMM: ()[eng]: � 2004, Copyright resides with the artist, The 365 Days Project,  and UbuWeb (http://ubu.com) / PennSound (http://www.writing.upenn.edu/pennsound/). All materials at UbuWeb / PennSound are available for free exchange for noncommerical purposes.
365-Days-Project-04-26-sprinkle-leland-w-the-great-stalacpipe-organ.mp3: No ID3v1 tag

答案 1 :(得分:0)

最简单的方法是创建一个bash脚本。

grep您的工具返回的字段,以便您获得所需的字段。然后使用awk(如果您知道如何使用它)或cut等。

如果您向我们提供您找到的某个工具所使用的格式,我们可以帮助您编写它。格式越简单,脚本就越简单。

相关问题