将一批 MP3 文件的 mp3 标签的值复制到另一个标签

发布于 2024-12-02 01:20:20 字数 283 浏览 2 评论 0原文

我有一个很大的 MP3 目录,不知何故,文件的 album 标签(或 专辑名称)的值(对于所有文件来说,有数百个)实际上是 的值>艺术家标签(或艺术家姓名),反之亦然。

现在我必须相互复制这些值,以便将它们交换到目录中的每个文件。或者也许我可以交换标签名称。我只希望 artist 标签显示艺术家姓名,album 标签显示专辑名称。

批量编辑应该如何完成?

I have a large MP3 directory and somehow the values of album tags (or album names) of the files (for all of them, hundreds) are actually the values of artist tags (or artist names) and vice-versa.

Now I have to copy the values from each other so that they are swapped for each and every single file in the directory. Or maybe I can just swap the tag names. I just want the artist tag to show artist names and album tags to show album name.

How should it be done as a batch edit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七分※倦醒 2024-12-09 01:20:20

不幸的是,mp3 的标签相当棘手,但以下 python 脚本(需要库 mutagen)可以完成 ogg 和 flac 的工作,至少解决了我自己的问题。

#! /usr/bin/env python
# Copyright (c) 2011 kaleissin
# MIT License, see http://www.opensource.org/licenses/mit-license.php

import mutagen
import os
import os.path

if len(sys.argv[1:]) < 1:
    print "Usage: %s <file> [file..]" % os.path.basename(__file__)

for filename in sys.argv[1:]:
    audio = mutagen.File(filename)
    audio['artist'], audio['title'] = audio['title'], audio['artist']
    audio.save()

Unfortunately tags for mp3 is rather tricky but the following python script (requires the library mutagen) does the job for ogg and flac, solving my own problem at least.

#! /usr/bin/env python
# Copyright (c) 2011 kaleissin
# MIT License, see http://www.opensource.org/licenses/mit-license.php

import mutagen
import os
import os.path

if len(sys.argv[1:]) < 1:
    print "Usage: %s <file> [file..]" % os.path.basename(__file__)

for filename in sys.argv[1:]:
    audio = mutagen.File(filename)
    audio['artist'], audio['title'] = audio['title'], audio['artist']
    audio.save()
黯淡〆 2024-12-09 01:20:20

ID3 批量标记器 (https://github.com/squell/id3)应该有帮助。适用于 Windows 和 Linux。

交换所有 mp3 文件中的艺术家和专辑字段。

id3 -a %l -l %a "*.mp3"

Sets keys:
-a sets the artist key
-l sets the album key

Substitutes of current key values:
%t title
%a artist
%l album title
%n track number
%y year
%g genre
%c comment field
%f file name (without path)
%p path to filename

首先在样品上使用。

ID3 Mass Tagger (https://github.com/squell/id3) should help. Works on Windows and Linux.

Swap artist and album fields in all mp3 files.

id3 -a %l -l %a "*.mp3"

Sets keys:
-a sets the artist key
-l sets the album key

Substitutes of current key values:
%t title
%a artist
%l album title
%n track number
%y year
%g genre
%c comment field
%f file name (without path)
%p path to filename

Use on a sample first.

迷你仙 2024-12-09 01:20:20

查看 mid3cp 工具 python-mutagen 库正是您所寻找的。

在 Ubuntu 下,默认情况下不会安装它,但如果您只是将 this< 的内容放入/a> 文件位于 /usr/bin 中并使其可执行。

Check out the mid3cp tool from the python-mutagen library which does exactly what you are looking for.

Under Ubuntu it is not installed by default but if you simply put the content of this file in /usr/bin and make it executable it works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文