Skip to content

7s9n/pythonTaglib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytag

pytag is a Python audio tagging library. It is cross-platform, and is very simple to use yet fully featured:

pytag is a very thin wrapper (≈366 lines of code) around the fast and rock-solid TagLib C++ library.

Usage

import pytag
>>> song = pytag.File('/path/to/my/file.mp3')
>>> tag = song.tags
>>> tag.title
Hussein Sarea
>>> tag.title = 'New title'
>>> tag.title
New title
>>> song.save()
>>> song.close()

Another example

import pytag
path = Path('/path/to/my/file.mp3')

with pytag.File(path) as tfile:
    tags = tfile[0]
    properties = tfile[1]
    
    # delete a specific tag
    del tags.title

    # edit a tag
    tags.artist = 'new artist'

    # you can also get audio properties information
    print(properties.length)
    print(properties.minutes)
    print(properties.seconds)
    print(properties.bitrate)
    print(properties.samplerate)
    print(properties.channels)

Manual Compilation: General

You can download or checkout the sources and compile manually:

    python setup.py build
    python setup.py test  # optional, run unit tests
    python setup.py install