Skip to main content

A tagging interface for multiple audio formats and metadata containers.

Project description


Build Status Coverage Status Pypi Pyversions

A tagging interface for multiple audio formats and metadata containers.

The supported audio codecs and containers are:

  • FLAC in FLAC container
  • MP3 in MP3 container
  • AAC in MP4 container
  • Vorbis in Ogg container
  • Opus in Ogg container

Tag mappings are derived from .


>>> from tagfiles import TagFile, ArtistRoles
>>> from pprint import pprint
>>> tf = TagFile('/home/azuline/02. No Captain.m4a')
>>> print(tf.title)
No Captain
>>> pprint(tf.artist)
{<ArtistRoles.MAIN: 1>: ['Lane 8'],
 <ArtistRoles.FEATURE: 2>: ['Poliça'],
 <ArtistRoles.REMIXER: 3>: [],
 <ArtistRoles.PRODUCER: 4>: [],
 <ArtistRoles.COMPOSER: 5>: [''],
 <ArtistRoles.CONDUCTOR: 6>: [],
 <ArtistRoles.DJMIXER: 7>: []}
>>> print(tf.artist[ArtistRoles.MAIN])
['Lane 8']
>>> print(
>>> print(
>>> = '2018-01-19'  # Fixing the date!
>>> print(
>>> print(
>>> tf = TagFile('/home/azuline/music.txt')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/azuline/devel/tagfiles/tagfiles/", line 27, in TagFile
    raise UnsupportedFileType

The TagFile function takes a filepath as a parameter and returns the class which corresponds to its container. If an unsupported filetype is passed in, the UnsupportedFileType error is raised. Each class presents the same metadata interface, which have the following attributes:

title: str
version: str
album: str
artist_album: List[str]
catalog_number: str
release_type: str
comment: str
date.year: int str
track_number: str
track_total: str
disc_number: str
disc_total: str
genre: List[str]
label: str
artist = {
  ArtistRoles.MAIN: List[str]
  ArtistRoles.FEATURE: List[str]
  ArtistRoles.REMIXER: List[str]
  ArtistRoles.PRODUCER: List[str]
  ArtistRoles.COMPOSER: List[str]
  ArtistRoles.CONDUCTOR: List[str]
  ArtistRoles.DJMIXER: List[str]

Fields can be edited by setting new values to the attributes of the TagFile. To edit the date, which is special, assign a string in the format of %Y-%m-%d or %Y to the date attribute. To save the changes made to the tags, call the save() method.

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tagfiles, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size tagfiles-0.2.0-py3-none-any.whl (12.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size tagfiles-0.2.0.tar.gz (11.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page