【问题标题】:ID3 tag editing in programming language编程语言中的 ID3 标签编辑
【发布时间】:2013-08-19 23:48:23
【问题描述】:

鉴于文件夹结构为“musicFolder\Artist\Year Album\## Song.mp3”,我一直在尝试编写一个程序来编辑给定艺术家的所有歌曲的 ID3 标签。它将编辑标签标题、艺术家、专辑艺术家、专辑、年份和曲目(歌曲编号),同时保留流派值。到目前为止,我已经在 python 中尝试过,但没有一个 ID3 插件能够成功。我在这里描述了使用诱变剂时遇到的问题:Some mutagen tags don't work

所以,我需要一个可以执行上述操作的任何语言的插件(并告诉我两者的版本!),并且我还希望提供一个如何设置所述标签值的示例,以及(如有必要)确保流派标签不受影响的必要措施。因为我只知道 python 和 java,如果提供的语言不是其中之一,如果有人愿意通过将下面提供的伪代码(或具有相同效果的东西)转换为实际代码来帮助我,我也将不胜感激。

import id3plugin

artist = next_input()
path = "E:\Musik\" + artist

for folder in folder_list(path):                         # folders as strings
    path2 = path + "\" + folder
    year = int(folder.substring(0,4))                    # characters 0,1,2,3 of folder name
    album = folder.substring(5,end))                     # character 4 is space

    for file in file_list(path2):
        if file.substring(end-4,end) == ".mp3": continue # skip to the next item in the list

        path3 = path2 + "\" + file
        tracknumber = int(file.substring(0,2))
        songtitle = file.substring(3, end-4)

        # if all previous tags are cleared when editing, save genre here...

        id3plugin.set_title(path3, title)
        id3plugin.set_artist(path3, artist)
        id3plugin.set_albumartist(path3, artist)
        id3plugin.set_album(path3, album)
        id3plugin.set_year(path3, year)
        id3plugin.set_track(path3, tracknumber)

        # ... and set genre here

【问题讨论】:

    标签: mp3 pseudocode id3 mutagen


    【解决方案1】:

    我已经在我的 Java 播放器中成功使用了Jaudiotagger

    Jaudiotagger 是 Jaikoz 使用的音频标记库,用于标记音频文件中的数据。它目前完全支持 Mp3、Mp4(Mp4 音频、M4a 和 M4p 音频)Ogg Vorbis、Flac 和 Wma,对 Wav 和 Real 格式的支持有限。

    • 支持 MP3 ID3v1、ID3v11、ID3v2.2、v2.3 和 v2.4 是透明的

    【讨论】:

    • 您的答案出现在低质量帖子评论中。请尝试提供更多上下文。不鼓励仅提供链接的答案。
    • 我下载了 jaudiotagger-2.2.0-20130321.142353-1-javadoc.jar(并重命名为 jaudiotagger)。这是编译方式:“javac -classpath [path]\jaudiotagger.jar id3tag.java”,如何将其导入程序本身?代码示例似乎没有涵盖这一点。
    • 要添加到库中的文件是 jaudiotagger-2.2.0-20130321.162819-3.jar。你用的是什么IDE?在 Eclipse 中,您应该转到 Project>Properties>Java Build Path,然后在“Libraries”选项卡中,您应该“Add External JAR ...”
    猜你喜欢
    • 2012-05-03
    • 2017-02-01
    • 2012-10-22
    • 1970-01-01
    • 2021-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-20
    相关资源
    最近更新 更多