首页 > 解决方案 > MP3 标签不保存在 Python 中

问题描述

我正在尝试将 MP3 标签保存到文件夹中的文件中。我已将电子表格中的新值分配给temp_track如下,但找不到完成最后一步以使用新数据保存文件的方法。

我的代码:

tlt = sheet2.cell(row=a+1, column=14)
            temp_track.title = tlt.value
            print('Title of Song: ' + temp_track.title)

运行窗口中显示的数据:

Title of Song: (66 REV 022) - Revelation 22

我试过TinyTag.tag.save()但收到错误消息

AttributeError: type object 'TinyTag' has no attribute 'tag'

可以使用什么属性将新的 MP3 标签保存到文件中?

标签: pythonpython-3.xmp3

解决方案


如果您使用来自 pypi https://pypi.org/project/tinytag/https://github.com/devsnd/tinytag的 TinyTag,则该库仅用于读取。它不能用于修改现有文件。

如果要编辑 mp3 文件的 ID3 标签,请尝试 mp3-tagger https://pypi.org/project/mp3-tagger/https://github.com/artcom-net/mp3-tagger


推荐阅读