Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
pytaglib is a Python audio tagging library. It is cross-platform and 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.
2024-03-16 pytaglib-3.0.0 has been released. Major improvements:
For a full list of changes in this and previous releases, see the Changelog.
Use pip:
pip install pytaglib
In 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, see below.
>>> import taglib
>>> with taglib.File("/path/to/my/file.mp3", save_on_exit=True) as song:
>>> 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"]
>>> # with save_on_exit=True, file will be saved at the end of the 'with' block
For detailed API documentation, use the docstrings of the taglib.File
class or view the source code directly.
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.
Things 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
the libtag1-dev
and python-dev
packages. On Fedora and friends, these are called taglib-devel
and python-devel
, respectively. On a Mac, use HomeBrew to install the taglib
package. For Windows, see below.
As an alternative, run python build_native_taglib.py
in this directory to
automatically download and build the latest Taglib version into the lib/taglib-cpp
subdirectory (also works on
Windows).
This requires Python and a suitable compiler to be installed; specific instructions are beyond the scope of this README.
python3-taglib
. Unfortunatelly, they are heavily outdated, so you should instally the recent version via pip
whenever possible.You 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 pytest
If you just want to create a binary wheel for your platform, use build:
pip install --upgrade build # ensure build is installed
python -m build
which will place the wheel inside the dist
directory.
Install MS Visual Studio Build Tools (or the complete IE) and include the correct compiler version as detailed here. Also enable cmake in the Visual Studio Installer.
Then:
python build_native_taglib.py
which will download and build the latest official TagLib releasepython setup.py install
For bug reports or feature requests, please use the issue tracker on GitHub. For anything else, contact me by email.
FAQs
cross-platform, Python audio metadata ("tagging") library based on TagLib
We found that pytaglib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.