Loading...

Curate your music collection with eyeD3

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

eyeD3 is a Python module and program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3 v1.0/v1.1 and v2.3/v2.4. This is a collection of examples how to organise your digital music collection with eyeD3.

Installation

apt-get install eyed3

ID3 Tag Management

Operations on id3 tags

Removal

To remove id3v1 use

eyeD3 --remove-v1 my.mp3

To remove id3v2 use

eyeD3 --remove-v2 my.mp3

To remove all

eyeD3 --remove-all my.mp3

Conversion

To convert to id3v2.4 use

eyeD3 --to-v2.4 *.mp3

To convert to id3v2.3 use

eyeD3 --to-v2.3 *.mp3

ID3 Meta-Data

Unique File Id

To remove e.g. MusicBrainz do

eyeD3 --unique-file-id="http://musicbrainz.org:" *.mp3

Artist

Set artist

eyeD3 -a "Lady Gaga" *.mp3

or

eyeD3 --artist="Lady Gaga" *.mp3

Album Artist

Album Artist is stored in field TPE2, see http://id3.org/id3v2.3.0

eyeD3 --set-text-frame=TPE2:"Various Artists" *.mp3

Album

Set album

eyeD3 -A "Forrest Gump" *.mp3

or

eyeD3 --album="Forrest Gump" *.mp3

Track

Set track total to 17 for all mp3

eyeD3 -N 17 *.mp3

Grab track number from filename, assuming that file list has track number as prefix

-rwxrwx--- 1 tan tan  8709298 Jul 31 22:33 01 Le Mapper - Ghost.mp3*
-rwxrwx--- 1 tan tan  9480441 Jul 31 22:33 02 Le Parser - Sing.mp3*
#!/bin/sh
for f in *.mp3; do
    eyeD3 -n ${f:0:2} "$f"
done

Publisher

To remove publisher set to empty.

eyeD3 --publisher="" mixed.mp3
eyeD3 -p "" mixed.mp3

Text Frame

Remove text frame

eyeD3 --set-text-frame=WXXX:"" *.mp3

TPOS

The disc number itself is a text frame.

The ‘Part of a set’ frame is a numeric string that describes which part of a set the audio came from. This frame is used if the source described in the “TALB” frame is divided into several mediums, e.g. a double CD. The value may be extended with a “/” character and a numeric string containing the total number of parts in the set. E.g. “1/2”.

Example: Set disc number 1 of 2

eyeD3 --set-text-frame=TPOS:"1/2" *.mp3

Example: Set disc number 2 of 2

eyeD3 --set-text-frame=TPOS:"2/2" *.mp3

User Text Frame

Set user text frame e.g. ripping tool

eyeD3 --set-user-text-frame="Ripping tool:grip" *.mp3

If you leave the argument blank, it removes the user text frame for all mp3

eyeD3 --set-user-text-frame="Ripping tool:" *.mp3

If you can’t remove a user text frame you should convert the id3 tag to v2.4. After that you should remove it easily.

Genre

List availables genres

eyeD3 --list-genres
  0: Blues                               75: Polka
  1: Classic Rock                        76: Retro
  2: Country                             77: Musical
  3: Dance                               78: Rock & Roll
  4: Disco                               79: Hard Rock
  5: Funk                                80: Folk
  6: Grunge                              81: Folk-Rock
  7: Hip-Hop                             82: National Folk
  8: Jazz                                83: Swing
  9: Metal                               84: Fast  Fusion
 10: New Age                             85: Bebob
 11: Oldies                              86: Latin
 12: Other                               87: Revival
 13: Pop                                 88: Celtic
 14: R&B                                 89: Bluegrass
 15: Rap                                 90: Avantgarde
 16: Reggae                              91: Gothic Rock
 17: Rock                                92: Progressive Rock
 18: Techno                              93: Psychedelic Rock
 19: Industrial                          94: Symphonic Rock
 20: Alternative                         95: Slow Rock
 21: Ska                                 96: Big Band
 22: Death Metal                         97: Chorus
 23: Pranks                              98: Easy Listening
 24: Soundtrack                          99: Acoustic
 25: Euro-Techno                        100: Humour
 26: Ambient                            101: Speech
 27: Trip-Hop                           102: Chanson
 28: Vocal                              103: Opera
 29: Jazz+Funk                          104: Chamber Music
 30: Fusion                             105: Sonata
 31: Trance                             106: Symphony
 32: Classical                          107: Booty Bass
 33: Instrumental                       108: Primus
 34: Acid                               109: Porn Groove
 35: House                              110: Satire
 36: Game                               111: Slow Jam
 37: Sound Clip                         112: Club
 38: Gospel                             113: Tango
 39: Noise                              114: Samba
 40: AlternRock                         115: Folklore
 41: Bass                               116: Ballad
 42: Soul                               117: Power Ballad
 43: Punk                               118: Rhythmic Soul
 44: Space                              119: Freestyle
 45: Meditative                         120: Duet
 46: Instrumental Pop                   121: Punk Rock
 47: Instrumental Rock                  122: Drum Solo
 48: Ethnic                             123: A Cappella
 49: Gothic                             124: Euro-House
 50: Darkwave                           125: Dance Hall
 51: Techno-Industrial                  126: Goa
 52: Electronic                         127: Drum & Bass
 53: Pop-Folk                           128: Club-House
 54: Eurodance                          129: Hardcore
 55: Dream                              130: Terror
 56: Southern Rock                      131: Indie
 57: Comedy                             132: BritPop
 58: Cult                               133: Negerpunk
 59: Gangsta Rap                        134: Polsk Punk
 60: Top 40                             135: Beat
 61: Christian Rap                      136: Christian Gangsta Rap
 62: Pop / Funk                         137: Heavy Metal
 63: Jungle                             138: Black Metal
 64: Native American                    139: Crossover
 65: Cabaret                            140: Contemporary Christian
 66: New Wave                           141: Christian Rock
 67: Psychedelic                        142: Merengue
 68: Rave                               143: Salsa
 69: Showtunes                          144: Thrash Metal
 70: Trailer                            145: Anime
 71: Lo-Fi                              146: JPop
 72: Tribal                             147: Synthpop
 73: Acid Punk                          148: Rock/Pop
 74: Acid Jazz

Set genre

eyeD3 --genre=Dance dance.mp3

Comments

eyeD3 --remove-comments *.mp3

GEOB

Sometimes General encapsulated object (GEOB) are hidden in id3 Tags.

Remove GEOB

eyeD3 --set-text-frame=GEOB: music.mp3

Cleanup

A cleanup script, that removes and strips down meta-data in id3 tags of mp3 files. Depending on my definition of unnecessary meta-data wink. Add this to /usr/local/bin, requires eyeD3 and id3v2 to be installed. Just cd to the folder and run id3-cleanup.sh.

#!/bin/sh
for file in *.mp3; do
    eyeD3 --remove-comments \
        --remove-lyrics \
        --set-user-text-frame=TXXX: \
        --set-text-frame=TXXX: \
        --set-text-frame=TCMP: \
        --set-text-frame=PRIV: \
        --set-text-frame=WXXX: \
        --remove-images \
        --no-tagging-time-frame "$file"
    id3v2 -s "$file"
done

Use UFID (Unique File Identifier) to remove persistent unremovable entries.

#!/bin/sh
for file in *.mp3; do
    eyeD3 --remove-comments \
        --remove-lyrics \
        --remove-images \
        --set-user-text-frame=UFID: \
        --set-text-frame=UFID: \
        --no-tagging-time-frame "$file"
done

Use id3v2 to check if the cleanup works, some hidden fields are not displayed by eyeD3.

Images

Add images

Show supported types

$ eyeD3 --list-image-types
Available image types for --add-image:
	OTHER
	ICON
	OTHER_ICON
	FRONT_COVER
	BACK_COVER
	LEAFLET
	MEDIA
	LEAD_ARTIST
	ARTIST
	CONDUCTOR
	BAND
	COMPOSER
	LYRICIST
	RECORDING_LOCATION
	DURING_RECORDING
	DURING_PERFORMANCE
	VIDEO
	BRIGHT_COLORED_FISH
	ILLUSTRATION
	BAND_LOGO
	PUBLISHER_LOGO

Add FRONT_COVER (absolute path)

eyeD3 --add-image=/home/tan/cover/frontcover.jpg:FRONT_COVER track1.mp3

Example with relative path

eyeD3 --add-image=Cover.jpg:FRONT_COVER *.mp3

Extract Image

Extracts cover to /tmp directory

eyeD3 -i /tmp/ mysong.mp3

Remove images

eyeD3 --remove-images *.mp3

Rename MP3 from tag data

Following mp3 files, needs to be renamed. In the CD extraction process the track number was missing.

tan@dojo:~/tmp/mp3/cd1$ ll
total 104496
-rw-r--r-- 1 tan tan  5777408 Jan 15 22:42 George  Michael - A Different Corner.mp3
-rw-r--r-- 1 tan tan  8196096 Jan 15 22:42 George  Michael - A Moment With You.mp3
-rw-r--r-- 1 tan tan  7186432 Jan 15 22:42 George  Michael - Careless Whisper.mp3
-rw-r--r-- 1 tan tan 10412032 Jan 15 22:42 George  Michael - Cowboys And Angels.mp3
-rw-r--r-- 1 tan tan  4765696 Jan 15 22:42 George  Michael - Desafinado (With Astrud Gilberto).mp3
-rw-r--r-- 1 tan tan  8321024 Jan 15 22:42 George  Michael - Dont Let The Sun Go Down On Me (With Elton John).mp3
-rw-r--r-- 1 tan tan  8130560 Jan 15 22:42 George  Michael - Father Figure.mp3
-rw-r--r-- 1 tan tan  6856704 Jan 15 22:42 George  Michael - Heal The Pain.mp3
-rw-r--r-- 1 tan tan  7686144 Jan 15 22:42 George  Michael - I Cant Make You Love Me.mp3
-rw-r--r-- 1 tan tan  9822208 Jan 15 22:42 George  Michael - Jesus To A Child.mp3
-rw-r--r-- 1 tan tan  6580224 Jan 15 22:42 George  Michael - Kissing A Fool.mp3
-rw-r--r-- 1 tan tan  8456192 Jan 15 22:42 George  Michael - One More Try.mp3
-rw-r--r-- 1 tan tan  6746112 Jan 15 22:42 George  Michael - Praying For Time.mp3
-rw-r--r-- 1 tan tan  7866368 Jan 15 22:42 George  Michael - You Have Been Loved.mp3

eyeD3 offers the rename function. Rename the file based on PATTERN which may contain the following substitution variables:

  • %A (artist),
  • %a (album),
  • %t (title),
  • %n (track number),
  • and %N (the total track count).

The PATTERN string MUST not contain the file name extension.

To add the track number, and remove the artist, use this simple pattern:

tan@dojo:~/tmp/mp3/cd1$ eyeD3 --rename=%n-%t *.mp3

renames the files to

tan@dojo:~/tmp/mp3/cd1$ ll
total 104496
-rw-r--r-- 1 tan tan  9822208 Jan 15 22:42 01-Jesus To A Child.mp3
-rw-r--r-- 1 tan tan  8130560 Jan 15 22:42 02-Father Figure.mp3
-rw-r--r-- 1 tan tan  7186432 Jan 15 22:42 03-Careless Whisper.mp3
-rw-r--r-- 1 tan tan  8321024 Jan 15 22:42 04-Dont Let The Sun Go Down On Me (With Elton John).mp3
-rw-r--r-- 1 tan tan  7866368 Jan 15 22:42 05-You Have Been Loved.mp3
-rw-r--r-- 1 tan tan  6580224 Jan 15 22:42 06-Kissing A Fool.mp3
-rw-r--r-- 1 tan tan  7686144 Jan 15 22:42 07-I Cant Make You Love Me.mp3
-rw-r--r-- 1 tan tan  6856704 Jan 15 22:42 08-Heal The Pain.mp3
-rw-r--r-- 1 tan tan  8196096 Jan 15 22:42 09-A Moment With You.mp3
-rw-r--r-- 1 tan tan  4765696 Jan 15 22:42 10-Desafinado (With Astrud Gilberto).mp3
-rw-r--r-- 1 tan tan 10412032 Jan 15 22:42 11-Cowboys And Angels.mp3
-rw-r--r-- 1 tan tan  6746112 Jan 15 22:42 12-Praying For Time.mp3
-rw-r--r-- 1 tan tan  8456192 Jan 15 22:42 13-One More Try.mp3
-rw-r--r-- 1 tan tan  5777408 Jan 15 22:42 14-A Different Corner.mp3

Known Bugs

Please remember the terms for blog comments.