2

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?

amar
  • 473
  • 1
  • 7
  • 20

3 Answers3

1

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()
kaleissin
  • 1,245
  • 13
  • 19
  • I tried but it didn't work. I will try some modifications and update here if that works. – amar Sep 08 '11 at 20:01
0

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.

jackpots
  • 21
  • 2
0

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.

Dennis Vash
  • 50,196
  • 9
  • 100
  • 118
Master
  • 1