import os
import re
import eyed3 as eyed3
path = 'D:\\歌曲\\改真无损\data\\'#歌曲目录
"""
改MP3信息 参考内容https://www.cnblogs.com/yanzhen/p/14014999.html https://www.cnblogs.com/jaysonteng/p/12312828.html
"""
files = os.listdir(path) # 获得目录中所有文件
l = 0
for item in files:
if item.endswith('.mp3') or item.endswith('.mp4'):
item_path = path + item
print(item_path)
if re.findall(rf'.(.*?) -', item):
song_auth = re.findall(rf'.(.*?) -', item)[0].split('.')[1]
elif re.findall(rf'.(.*?)-', item):
song_auth = re.findall(rf'.(.*?)-', item)[0].split('.')[1]
else:
pass
if re.findall(rf'- (.*?).mp', item):
song_name = re.findall(rf'- (.*?).mp', item)[0].replace('\n', '').replace('\r', '')
else :
song_name = re.findall(rf'-(.*?).mp', item)[0].replace('\n', '').replace('\r', '')
audiofile = eyed3.load(item_path)
audiofile.initTag()
audiofile.tag.artist = u"{}".format('song_auth22') # 参与创作的艺术家
audiofile.tag.album_artist = u"{}".format('song_auth22') # 唱片艺术家
audiofile.tag.title = u"{}".format(song_name) # 标题不是文件名称
audiofile.tag.save()
print(song_auth,song_name)
l =l+1
print(l)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?