Package: pytaglib
pytaglibpytaglib is aPythonaudio tagging library. It is cross-platform and very simple to use yet fully featured:supports more than a dozen file formatsincluding mp3, flac, ogg, wma, and mp4,support arbitrary, non-standard tag names,support multiple values per tag.pytaglib is a very thin wrapper (≈150 lines ofcode) around the fast and rock-solidTagLibC++ library.News2023-11-17pytaglib-2.1.0 has been released. Major improvements:!118: update Taglib version for binary wheels to 1.13.1!116: fix Python 3.12 buildFor a full list of changes in this and previous releases, see theChangelog.InstallUsepip:pip install pytaglibIn most cases, this should pick a provided binary wheel that bundles the native TagLib library suitable for your platform. If it doesn't, and the
installation fails, seebelow.Usage>>>importtaglib>>>withtaglib.File("/path/to/my/file.mp3",save_on_exit=True)assong:>>>song.tags{'ARTIST':['piman','jzig'],'ALBUM':['Quod Libet Test Data'],'TITLE':['Silence'],'GENRE':['Silence'],'TRACKNUMBER':['02/10'],'DATE':['2004']}>>>song.length239>>>song.tags["ALBUM"]=["White Album"]# always use lists, even for single values>>>delsong.tags["DATE"]>>>song.tags["GENRE"]=["Vocal","Classical"]>>>song.tags["PERFORMER:HARPSICHORD"]=["Ton Koopman"]>>># with save_on_exit=True, file will be saved at the end of the 'with' blockFor detailed API documentation, use the docstrings of thetaglib.Fileclass or view thesource codedirectly.pyprinttagsThis package also installs thepyprinttagsscript. It takes one or more files as
command-line parameters and will display all known metadata of that files on the terminal.
If unsupported tags (a.k.a. non-textual information) are found, they can optionally be removed
from the file.Installation NotesThings are a bit more complicated than usual with Python because pytaglib requires the native (C++) TagLib library.If there are no binary wheels for your platform, or you want to manually
compile pytaglib, you will need to have Taglib installed with development headers,
and also development tools for Python.On Ubuntu, Mint and other Debian-Based distributions, install
thelibtag1-devandpython-devpackages. On Fedora and friends, these are calledtaglib-develandpython-devel, respectively. On a Mac, use HomeBrew to install thetaglibpackage. For Windows, see below.As an alternative, runpython build_taglib.pyin this directory to
automatically download and build the latest Taglib version into thebuildsubdirectory (also works on Windows). This requires Python and a
suitable compiler to be installed; specific instructions are beyond the
scope of this README.Linux: Distribution-Specific PackagesDebian- and Ubuntu-based linux flavors have binary packages for the Python 3 version, calledpython3-taglib. Unfortunatelly, they are heavily outdated, so you should instally the recent version viapipwhenever possible.For Arch users, there is apackagein the user repository (AUR).Manual Compilation: GeneralYou can download or checkout the sources and compile manually:pip install .
    # if you want to run the unit tests, use these commands instead
    # pip install '.[tests]'
    # python -m pytestIf you just want to create a binary wheel for your platform, usebuild:pip install --upgrade build # ensure build is installed
    python -m buildwhich will place the wheel inside thedistdirectory.Compilation: WindowsInstall MS Visual Studio Build Tools (or the complete IE) and include the correct compiler version as detailedhere. Also enablecmakein the Visual Studio Installer.Then:open the VS native tools command promptnavigate to thepytaglibrepositoryrunpython build_taglib.pywhich will download and build the latest official TagLib releaserunpython setup.py installContactFor bug reports or feature requests, please use theissue trackeron GitHub. For anything else, contact
me byemail.