1

基本上,我有一堆从我兄弟的 iPod 中提取的音乐文件,它们保留了它们的元数据,但有 iPod 似乎喜欢将它们存储在下面的那些绝对可怕的四个字符名称。我想我会写一个不错的、快速的脚本来按我的意愿重命名它们,但我很好奇任何用于读取 ID3 元数据的好的库。我更喜欢 Perl 或 Python。我对 Perl 很满意,因为我在工作中使用它,而 Python 我需要更多的练习,它会让我的 Python 传道者朋友开心。

无论如何,缩短版:您能否为 Python 或 Perl 命名一个好的库/模块,让我可以轻松地从一堆 mp3 中提取 ID3 元数据?

4

7 回答 7

9

当您搜索 ID3时, CPAN Search会出现几个 Perl 模块。几乎所有以“Is there a library...”开头的 Perl 问题的答案都是检查 CPAN。

我倾向于喜欢MP3::Tag,但像我这样的老年人倾向于找到合适的东西而忽略所有技术进步,直到我们被迫改变。

于 2009-06-16T09:15:53.017 回答
5

这里有几个python库

http://id3-py.sourceforge.net/

http://nedbatchelder.com/code/modules/id3reader.html

http://code.google.com/p/mutagen/ [更新网址]

于 2009-06-16T08:17:17.527 回答
4

http://www.id3.org/Implementations

于 2009-06-16T08:12:50.623 回答
2

我对MP3::Info很幸运。

于 2009-06-16T12:23:04.090 回答
2

MP3::Tag也很棒。同样,如果您正在寻找 Perl 模块,请先访问 search.cpan.org。

 use MP3::Tag;

  $mp3 = MP3::Tag->new($filename);

  # get some information about the file in the easiest way
  ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
  # Or:
  $comment = $mp3->comment();
  $dedicated_to
    = $mp3->select_id3v2_frame_by_descr('COMM(fre,fra,eng,#0)[dedicated to]');

  $mp3->title_set('New title');         # Edit in-memory copy
  $mp3->select_id3v2_frame_by_descr('TALB', 'New album name'); # Edit in memory
  $mp3->select_id3v2_frame_by_descr('RBUF', $n1, $n2, $n3);    # Edit in memory
  $mp3->update_tags(year => 1866);      # Edit in-memory, and commit to file
  $mp3->update_tags();                  # Commit to file
于 2009-06-17T02:10:19.087 回答
1

我认为这个片段:Rename MP3 files from ID3 tags from python recipies 可能会有所帮助。它使用id3reader库。

于 2009-06-16T22:56:34.593 回答
0

Python 包索引有一个与此处搜索“id3”匹配的 python 包列表,其中前几个似乎与您的需求有关。与上面布赖恩的回答一样,任何“是否有一个 python 模块......”的答案可能从 PyPI 开始。

于 2009-06-17T03:06:53.027 回答