A library for reading and, in the future, writing metadata from audio files.
Project description
audio-metadata
audio-metadata is a library for reading and, in the future, writing metadata from audio files.
Why another audio metadata library? / Why not just use mutagen et al?
Clean and understandable code, nice API, and good UX (user experience) are the focal points of audio-metadata. One or more of these things I feel are lacking from already existing alternatives enough to want to write something from scratch with them in mind. Also, there are certain features not present in other solutions that would be prohibitively painful to add.
So, why should I use it?
Features and functionality that set it apart:
- Uses the Python standard load(s)/dump(s) API.
- Can load filepaths, file-like objects and binary data (bytes-like objects).
- Metadata objects look like a dict and act like a dict.
- Some common libraries shadow the representation of a dict and/or dict methods but do not behave like a dict.
- Supports attribute-style access that can be mixed with dict key-subscription.
- All metadata objects have user-friendly representations.
- This includes humanized representations of certain values like filesize, bitrate, duration, and sample rate.
>>> import audio_metadata
>>> metadata = audio_metadata.load('05 - Heart of Hearts.flac')
>>> metadata
<FLAC ({
'filepath': '05 - Heart of Hearts.flac',
'filesize': '44.23 MiB',
'pictures': [],
'seektable': <FLACSeekTable (37 seekpoints)>,
'streaminfo': <FLACStreamInfo ({
'bit_depth': 16,
'bitrate': '1022 Kbps',
'channels': 2,
'duration': '06:03',
'md5': '3ae700893d099a5d281a5d8db7847671',
'sample_rate': '44.1 KHz',
})>,
'tags': <VorbisComment ({
'album': ['Myth Takes'],
'artist': ['!!!'],
'bpm': ['119'],
'date': ['2007'],
'genre': ['Dance Punk'],
'title': ['Heart of Hearts'],
'tracknumber': ['05'],
})>,
})>
>>> metadata['streaminfo']
<FLACStreamInfo ({
'bit_depth': 16,
'bitrate': '1022 Kbps',
'channels': 2,
'duration': '06:03',
'md5': '3ae700893d099a5d281a5d8db7847671',
'sample_rate': '44.1 KHz',
})>
>>> metadata.streaminfo.bitrate
1022134.0362995076
>>> metadata.streaminfo['duration']
362.9066666666667
>>> metadata['streaminfo'].sample_rate
44100
Installation
pip install audio-metadata
Usage
For the release version, see the stable docs.
For the development version, see the latest docs.
The high-level API and basic usage are covered, but more advanced features/functionality need documentation.
TODO
Please don't submit issues regarding the following:
- Docs, docs, and more docs.
- Finish ID3 abstractions.
- Add support for more file formats.
- MP4 reading is already well underway.
- Add write support.
If you're willing to contribute your time to work on them, post on the Development category on the Discourse forum.
Appreciation
Showing appreciation is always welcome.
Thank
Get your own thanks inbox at SayThanks.io.
Contribute
Contribute by submitting bug reports, feature requests, or code.
Help Others/Stay Informed
Referrals/Donations
BTC: 1BMLCFPcX8YHE1He2t3aBrsNDGr1pKhfFa
ETH: 0x8E3f8d8eAedeA61Bf34A998A2104954FE508D5d0
LTC: LgsQU1YaY4a4s7m9efjn6m35XhVEpW1xoP
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
Hashes for audio_metadata-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1735a596efeb2d6d81a32ad6a8b3282374ca47a955008a70155f2a06e86f7230 |
|
MD5 | 24ca0d54184780e9ad8f63a8844c2f43 |
|
BLAKE2b-256 | b3a959551397abe838433c2214506615ce4adb0c4478a89e03ddb524db06bcd1 |