Python (2.6+/3.1+) bindings for the TagLib audio metadata library
Project description
Overview
pytaglib is a full-featured, easy-to-use, cross-platform audio metadata (“tag”) library for Python (all versions supported). It uses the popular, fast and rock-solid TagLib C++ library internally; pytaglib is a very thin wrapper about TagLib (<150 lines of code), meaning that you immediately profit from the underlying library’s speed and stability.
Features include support of more than a dozen file formats, arbitrary tag names, and multiple values per tag.
Usage Example
Open a file and read its tags:
>>> 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']}Read some additional properties of the file:
>>> song.length 239 >>> song.channels 2Change the file’s tags:
>>> song.tags["ALBUM"] = ["White Album"] # always use lists, even for single values >>> del song.tags["DATE"]Multiple values per tag:
>>> song.tags["GENRE"] = ["Vocal", "Classical"]Non-standard tags:
>>> song.tags["PERFORMER:HARPSICHORD"] = ["Ton Koopman"]Save your chanes:
>>> returnvalue = song.save() >>> retval {}The dictionary returned by save contains all tags that could not be saved (might happen if the specific format does not support e.g. multi-values).
Installation
The most recommended installation method is
pip install pytaglib
where you should ensure that:
pip points to the correct Python version; you might need to use, e.g., pip-3.5 to install pytaglib for another Python version than your system’s default.
you may need administrator rights to install a package, i.e., sudo pip install pytaglib on Unix or running the command on a Admin console on windows
you can alternatively install into your user home with pip install --user pytaglib.
If the above does not work, continue reading for alternative methods of installation.
Linux / Unix
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 use the above “pip” method whenever possible.
For Arch users, there is a package in the user repository (AUR).
Manual Compilation
Alternatively, you can download / checkout the sources and compile manually:
python setup.py build python setup.py test # optional sudo python setup.py install
For this to work, you need to have taglib installed with development headers (package libtag1-dev for deb-based linux). If taglib is installed on a non-standard location, you can manually specify include and library directories:
python setup.py build --include-dirs /usr/local/include --library-dirs /usr/local/lib
Windows
Currently, the PyPI archive contains a binary version only for Python3.5/x64. For different combinations of Python version and architecture, you need to build yourself.
Note: The following procedure was tested for Python 3.5 on x64 only. Other python versions probably require some more work; see e.g. this page.
Install Microsoft Visual Studio 2015 Community Edition. In the installation process, be sure to enable C/C++ support.
Download and build taglib:
Download the current taglib release and extract it somewhere on your computer.
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
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.
Type msbuild INSTALL.vcxproj /p:Configuration=Release which will “install” taglib into the install subdirectory.
Still in the VS2015 command prompt, navigate to the pytaglib directory.
Tell pytaglib where to find taglib: set TAGLIB_HOME=C:\Path\To\Taglib\install
Build pytaglib: python setup.py build and install: python setup.py install
Contact
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytaglib-1.2.1.tar.gz.
File metadata
- Download URL: pytaglib-1.2.1.tar.gz
- Upload date:
- Size: 108.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d2166bce78725b5930ce812a3c4fe3fb624706a423c2eede513dd8d2a857ab9
|
|
| MD5 |
93c2e178988c43b9e8fdfb489563b04a
|
|
| BLAKE2b-256 |
642bca58714513f1beb587c0a118bdbb70298615c47038eb8c5a2a4334550639
|
File details
Details for the file pytaglib-1.2.1-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: pytaglib-1.2.1-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 285.6 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b3ecd1ee98a7f29cef1263f27ee259feb85d49a03709124e135ad60b44ca15
|
|
| MD5 |
cc976b00491e2c89d8651fea86b07216
|
|
| BLAKE2b-256 |
1e32b9462489b2317a6a67ae1f53f91ce6352ad15c323f69c11e764816caaf07
|