【问题标题】:Getting specific fields from ID3 tags using command line tool?使用命令行工具从 ID3 标签获取特定字段?
【发布时间】:2011-05-31 03:44:00
【问题描述】:

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

到目前为止,我发现的所有工具都返回 所有 字段,并且它们还对它们进行了格式化以“更容易阅读”。我只需要一些字段,并且格式不同(艺术家\talbum\ttitle\n)用于报告目的。

有没有这样的工具?我喜欢可以让我从 ID3v1 和 ID3v2 分别输出值的工具。

【问题讨论】:

    标签: linux shell mp3 id3


    【解决方案1】:

    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
    

    【讨论】:

    • 这很好,但问题是它仅适用于 v2。它是对应工具(id3 程序),具有 -R 选项,但不打印任何内容:(
    • @depesz: 对于id3 程序,你需要给它-l -R,然后它就会工作。 (仅仅-R 是不够的)
    【解决方案2】:

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

    grep 您的工具返回的字段,以便您获得所需的字段。然后你用awk(如果你知道怎么用的话),或者cut等等

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

    【讨论】:

    • 我想避免使用 grep/awk/sed - 因为在非标准字符的情况下会导致难以发现的问题。
    猜你喜欢
    • 2011-01-15
    • 1970-01-01
    • 2016-08-06
    • 1970-01-01
    • 1970-01-01
    • 2016-06-11
    • 2011-09-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多