Skip to main content

cross-platform, Python 2.x/3.x audio metadata ("tagging") library based on TagLib

Project description

pytaglib

CircleCI PyPI

pytaglib is a Python audio tagging library. It is cross-platform, works with all Python versions, and is very simple to use yet fully featured:

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

News

See the Changelog.

Get it

In most cases, you should install pytaglib with pip:

    pip install pytaglib

See installation notes below for requirements and manual compilation.

Usage

>>> import taglib
>>> song = taglib.File("/path/to/my/file.mp3")
>>> song.tags
{'ARTIST': ['piman', 'jzig'], 'ALBUM': ['Quod Libet Test Data'], 'TITLE': ['Silence'], 'GENRE': ['Silence'], 'TRACKNUMBER': ['02/10'], 'DATE': ['2004']}

>>> song.length
239
>>> song.tags["ALBUM"] = ["White Album"] # always use lists, even for single values
>>> del song.tags["DATE"]
>>> song.tags["GENRE"] = ["Vocal", "Classical"]
>>> song.tags["PERFORMER:HARPSICHORD"] = ["Ton Koopman"] 
>>> song.save()

For detailed API documentation, use the docstrings of the taglib.File class or view the source code directly.

Note: pytaglib uses unicode strings (type str in Python 3 and unicode in Python 2) for both tag names and values. The library converts byte-strings to unicode strings on assignment, but it is recommended to provide unicode strings only to avoid encoding problems.

pyprinttags

This package also installs the pyprinttags script. 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 Notes

  • Ensure that pip is installed and points to the correct Python version
    • on Windows, be sure to check install pip in the Python installer
    • on Debian/Ubuntu/Mint, install python3-pip (and/or python-pip)
    • you might need to type, e.g., pip-3 to install pytaglib for Python 3 if your system's default is Python 2.7.
  • For Windows users, there are some precompiled binary packages (wheels). See the PyPI page for a list of supported Python versions.
  • If no binary packages exists, you need to have both Python and taglib installed with development headers (packages python3-dev (or python-dev) and libtag1-dev for debian / ubuntu and derivates, python-devel and taglib-devel for fedora and friends, brew install taglib on OS X).

Linux: Distribution-Specific Packages

  • Debian- and Ubuntu-based linux flavors have binary packages for the Python 3 version, called python3-taglib. Unfortunatelly, they are heavily outdated, so you should instally the recent version via pip whenever possible.
  • For Arch users, there is a package in the user repository (AUR).

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
    sudo python setup.py install

Note: The taglib Python extension is built from taglib.cpp which in turn is auto-generated by Cython from taglib.pyx. To regenerate the taglib.cpp after making changes to taglib.pyx, set the environment variable PYTAGLIB_CYTHONIZE to 1 before calling setup.py or pip.

Manual Compilation: Windows

The following procedure was tested for Python 3.5 and Python 3.6 on Windows 10. Other platforms might require different steps; see e.g. this page.

  1. Install Microsoft Visual Studio 2015 Community Edition. In the installation process, be sure to enable C/C++ support. Alternatively, install Visual Studio 2017, but install the "v140" C++ toolset and use the "Visual Studio 2015" version of the developer command prompt below.
  2. Download and build taglib:
    1. Download the current taglib release and extract it somewhere on your computer.
    2. Start the VS2015 x64 Native Tools Command Prompt. On Windows 8/10, it might not appear in your start menu, but you can find it here: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts
    3. Navigate to the extracted taglib folder and type: cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=".\taglib-install" to generate the Visual Studio project files.
    4. Type msbuild INSTALL.vcxproj /p:Configuration=Release which will "install" taglib into the taglib-install subdirectory.
  3. Still in the VS2015 command prompt, navigate to the pytaglib directory.
  4. Tell pytaglib where to find taglib: set TAGLIB_HOME=C:\Path\To\taglib-install
  5. Build pytaglib: python setup.py build and install: python setup.py install

Contact

For bug reports or feature requests, please use the issue tracker on GitHub. For anything else, contact me by email.

Project details


Download files

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

Source Distribution

pytaglib-1.4.6.tar.gz (468.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytaglib-1.4.6-py3.9-win-amd64.egg (219.0 kB view details)

Uploaded Egg

pytaglib-1.4.6-py3.9-win32.egg (207.3 kB view details)

Uploaded Egg

pytaglib-1.4.6-cp38-cp38-win_amd64.whl (234.7 kB view details)

Uploaded CPython 3.8Windows x86-64

pytaglib-1.4.6-cp38-cp38-win32.whl (223.9 kB view details)

Uploaded CPython 3.8Windows x86

pytaglib-1.4.6-cp37-cp37m-win_amd64.whl (233.7 kB view details)

Uploaded CPython 3.7mWindows x86-64

pytaglib-1.4.6-cp37-cp37m-win32.whl (223.1 kB view details)

Uploaded CPython 3.7mWindows x86

File details

Details for the file pytaglib-1.4.6.tar.gz.

File metadata

  • Download URL: pytaglib-1.4.6.tar.gz
  • Upload date:
  • Size: 468.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for pytaglib-1.4.6.tar.gz
Algorithm Hash digest
SHA256 16daf54e78fb56442293d20d7659097470ecac9031f33037f9d53baa31382952
MD5 ddf326210c4ed0db9a05638191c03752
BLAKE2b-256 c744f054737af93d8bc57c3a23906e4e7d1b5538c7d96577746e5c4b2f92b181

See more details on using hashes here.

File details

Details for the file pytaglib-1.4.6-py3.9-win-amd64.egg.

File metadata

  • Download URL: pytaglib-1.4.6-py3.9-win-amd64.egg
  • Upload date:
  • Size: 219.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for pytaglib-1.4.6-py3.9-win-amd64.egg
Algorithm Hash digest
SHA256 90b08a178c78fc82c2203507f96bba4374d2207d355fa53dce71108006ac9862
MD5 35f932e88130cb6b156e4f2aa0588315
BLAKE2b-256 eaebd759471dfb9acbafd2d523458f9a29990fad860cdf506de6f6d48093b7c1

See more details on using hashes here.

File details

Details for the file pytaglib-1.4.6-py3.9-win32.egg.

File metadata

  • Download URL: pytaglib-1.4.6-py3.9-win32.egg
  • Upload date:
  • Size: 207.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for pytaglib-1.4.6-py3.9-win32.egg
Algorithm Hash digest
SHA256 68e740e944b169d201c29d892eb6dc7deff75a8c9c8a65336e4966d86706444e
MD5 ec6c0b6cfdde8e51fa78fb605a5087e6
BLAKE2b-256 9962544bb4cc9ba98291a9ca54d8b8a508e8c303a07006b9f393b4996c6df820

See more details on using hashes here.

File details

Details for the file pytaglib-1.4.6-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pytaglib-1.4.6-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 234.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pytaglib-1.4.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1bd0cb70f7107c250a911fb27768b181f4c209b0a2baa37c0bdffe5b55af8dc5
MD5 1ff0bdc681b6ccc660899610c1b71156
BLAKE2b-256 91a4bbcdb6ff9e69be4c54698db17bd1f771d544798cfd3a002db59869b1112f

See more details on using hashes here.

File details

Details for the file pytaglib-1.4.6-cp38-cp38-win32.whl.

File metadata

  • Download URL: pytaglib-1.4.6-cp38-cp38-win32.whl
  • Upload date:
  • Size: 223.9 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pytaglib-1.4.6-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 7e339a5e8ec3b5253e96d6c176986a9a4598957bb9e5408c5b9414576caccff1
MD5 07dc8e9bcf8b7c84bb58d600d29f5806
BLAKE2b-256 ded99c4e220a72f5bc68a4fd1c149b1c8c6ed7f740dbaeb603fb308199abfaf6

See more details on using hashes here.

File details

Details for the file pytaglib-1.4.6-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pytaglib-1.4.6-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 233.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pytaglib-1.4.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 98dc42f0dbb5fa7372570c4f56054a36dea9ba861513d53c0c4a425601b6ac42
MD5 c272bf8d37357e304f0f5b2731979c2a
BLAKE2b-256 7c2dddd8b9da3590a7c30820796de058ad5bcd8a1e4940d93f118847d9b84db6

See more details on using hashes here.

File details

Details for the file pytaglib-1.4.6-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pytaglib-1.4.6-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 223.1 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pytaglib-1.4.6-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 c3a9091a2bc539da223107f5be11d625b75acc0f69cd2466c92c34bb57980ea1
MD5 9d1d4df6bc089ec261f13cba98eefa53
BLAKE2b-256 64d7c55effe6e8bd952afb79b2dce44ef8621916f26249157b8521b4966c3451

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page