我一直在尝试编写一个程序来编辑给定艺术家的所有歌曲的 ID3 标签,因为文件夹结构是“musicFolder\Artist\Year Album\## Song.mp3”。它将编辑标签标题、艺术家、专辑艺术家、专辑、年份和曲目(歌曲编号),同时保持流派值。到目前为止,我已经在 python 中尝试过,但没有一个 ID3 插件能够成功。我在这里描述了使用诱变剂时遇到的问题:某些诱变剂标签不起作用。
所以,我需要一个可以执行上述操作的任何语言的插件(并告诉我两者的版本!),我也希望有一个如何设置所述标签值的示例,以及(如有必要)确保流派标签不受影响的必要措施。因为我只知道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