我正在尝试使用eyed3作为Python库,以便更改大量.MP3文件集的艺术家名称.我尝试使用项目网页的示例代码(http://eyed3.nicfit.net/)和setsaudiofile.tag.artist更改"贡献艺术家".根据文档(在http://eyed3.nicfit.net/api/eyed3.html),标签对象没有其他艺术家字段.
是否可以使用eyed3来实际更改专辑艺术家?如果是这样,你能提供清晰,简洁的Python代码吗?
对于大量 MP3 收藏,您可以将一位艺术家的所有歌曲放入特定文件夹中。例如:- 所有“Coldplay”歌曲都位于“Coldplay”文件夹中
如果您使用的是 Linux,您可以执行以下操作:-
import os
import eyed3
folder = raw_input('Please enter the folder of music')
files = os.listdir(folder) # This will give us a list of all of the MP3s in that folder
artist = folder.split('/')[-1]
for x in files:
mp3 = eyed3.load(folder + '/' + x) # Loads each and every MP3
mp3.tag.artist = unicode(artist, "UTF-8") # Sets the "artist" tag to the artist name
mp3.tag.save() # Saves tag
Run Code Online (Sandbox Code Playgroud)
如果您使用的是 Windows,只需编辑代码,将所有斜杠“/”改为反斜杠“”即可。
| 归档时间: |
|
| 查看次数: |
2786 次 |
| 最近记录: |