2013-08-19 111 views
0

由于文件夹结构是“musicFolder \ Artist \ Year Album \ ## Song”,我一直在编写一个编辑给定艺术家所有歌曲的ID3标签的程序。 MP3" 。它会在保持流派值的同时编辑标题标题,艺术家,专辑艺术家,专辑,年份和曲目(歌曲编号)。我已经尝试过python,但没有一个ID3插件已经解决。我在这里描述了我使用诱变剂时遇到的问题:Some mutagen tags don't work。因此,我需要一个可以执行上述操作的任何语言的插件(并告诉我两个版本都可以!),并且我还想知道如何设置所述标签值的示例,以及(如有必要)采取必要的措施以确保流派标签不受影响。因为我只知道python和java,如果提供的语言不是其中之一,如果有人想通过将下面提供的伪代码(或者具有相同效果的东西)转换为实际代码来帮助我,我也会很感激。用编程语言编辑ID3标签

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 

回答

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是透明
+1

你的答案出现在低质量的帖子审查。请尝试提供更多的上下文。不鼓励链接回答。 – brasofilo

+0

我下载了jaudiotagger-2.2.0-20130321.142353-1-javadoc.jar(并将其更名为jaudiotagger)。这是编译的方式:“javac -classpath [path] \ jaudiotagger.jar id3tag.java”,以及如何将它导入程序本身?代码示例似乎没有涵盖。 – Blrp

+0

你想添加到你的图书馆的文件是jaudiotagger-2.2.0-20130321.162819-3.jar。你在用什么IDE?在eclipse中你应该去Project> Properties> Java Build Path,在“Libraries”选项卡中你应该添加“External External JAR ...” –