本文介绍了在Python中更改文件元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我在这里搜索过,但没有找到指向可靠答案的任何内容.

Ok, I've searched around here but haven't found anything pointing to a solid answer.

我正在尝试在Windows中更改文件艺术家,文件名,等级,流派等,当您查看详细信息"中的文件夹时会显示该文件.

I'm trying to change a files artist, filename, rating, genre etc in windows, which shows up when you view folders in 'details'.

目前,我希望在列表中编辑文件,并且正在对它们进行迭代,但是正如我所说的那样,我不确定如何为列表中的每个文件进行更改.

At the moment I have the files I wish to edit in a list and I am iterating through them, but as I said I am not sure how to change it for each file in the list.

def Files(The_FileList):
'''Changes each files metadata'''
for each_file in The_FileList:

    #clueless here.

return The_FileList

需要像处理很多编码一样使用.avi/.mkv常规电影文件.

needs to work with .avi/.mkv general movie files as I do alot of encoding.

我正在寻找一个简单的选项,因为这是我要做的全部事情.

I'm looking for a simple option as this is all I want to do.

谢谢

推荐答案

在很多情况下(在这种情况下),元数据是特定于文件类型的. (某些文件系统提供它们自己的元数据,就像NTFS和更高版本一样,但是这种特定的元数据来自文件本身,而不是文件系统.)

In many cases (and in this case), metadata is file-type specific. (Some filesystems offer their own metadata, as NTFS and later do, but this particular metadata is coming from the file itself, and not from the filesystem).

要修改相关文件中的元数据,您可能可以使用 Mutagen库(假设它们是mp3/aac/flac/vorbis/etc-可能还有其他音频格式具有不同的元数据格式).

To modify the metadata in the files in question, you probably can use the Mutagen library (assuming these are mp3/aac/flac/vorbis/etc. - there are probably other audio formats that have a different metadata format).

这篇关于在Python中更改文件元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 17:12