随笔 - 56  文章 - 3 评论 - 0 阅读 - 2194
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

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)


posted on   我爱你的  阅读(47)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
点击右上角即可分享
微信分享提示