Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 诱变剂将年份元标记添加到MP3文件?_Python_Audio_Meta Tags_Mutagen - Fatal编程技术网

Python 诱变剂将年份元标记添加到MP3文件?

Python 诱变剂将年份元标记添加到MP3文件?,python,audio,meta-tags,mutagen,Python,Audio,Meta Tags,Mutagen,嘿,我用诱变剂公司的EasyMP3将元数据标签添加到音频文件中 我的代码如下 from mutagen.id3 import ID3, APIC, _util from mutagen.mp3 import EasyMP3 add_meta(filename,album,artist,song,year): tags = EasyMP3(file_name) if song: tags["title"] = song if arti

嘿,我用诱变剂公司的EasyMP3将元数据标签添加到音频文件中

我的代码如下

from mutagen.id3 import ID3, APIC, _util
from mutagen.mp3 import EasyMP3

add_meta(filename,album,artist,song,year):
    tags = EasyMP3(file_name)
    if song: 
        tags["title"] = song
    if artist:     
        tags["artist"] = artist
    if album:
        tags["album"] = album
    if year:
        tags["year"] = year

    tags.save()

    return file_name
但是在EasyMP3中,年份标签没有定义,所以我得到了一个错误,说年份不是一个有效的键,因为我刚刚开始使用诱变剂,我对它的其他实例不太了解。那么,如何将年份元数据标记添加到文件中


感谢您

查阅文档后返回一个。并非所有标签都支持开箱即用,但您可以注册可能需要使用的其他标签(以及更多相关功能)


对于
year
应该可以使用
EasyID3.RegisterTextKey(“year”,“TDRC”)
-检查。

这是否回答了您的问题?