tinytag is a library for reading music metadata of:

  • MP3 (ID3 v1, v1.1, v2.2, v2.3+)
  • Wave
  • OGG
  • FLAC

It works like:

from tinytag import TinyTag
tag = TinyTag.get('/some/music.mp3')
print('This track is by %s.' % tag.artist)
print('It is %f seconds long.' % tag.duration)

It could read metadata from the music file, and returns a TinyTag object, which would have attributes as follow:

tag.album         # album as string
tag.artist        # artist name as string
tag.audio_offset  # number of bytes before audio data begins
tag.bitrate       # bitrate in kBits/s
tag.duration      # duration of the song in seconds
tag.filesize      # file size in bytes
tag.samplerate    # samples per second
tag.title         # title of the song
tag.track         # track number as string
tag.track_total   # total number of tracks as string
tag.year          # year or data as string

The implementation is by pure Python code, no extra Python libraries, just tinytag itself to handle file parsing.

tinytag is written by Tom Wallroth under the GPLv3, was born in 2014-01-27, currently version 0.6.0 (2014-04-30), for both Python 2 and 3, plus PyPy.