Yet Unother MEtadata Embedder
Project description
Yumee
Embed metadata into your music files, whatever the type
Yumee stands for Yet Unother MEtadata Embedder
Features
- Automatic type detection based on the file extension
- Currently supported : MP3, M4A, FLAC, OGG (Vorbis), OPUS
- Detection of badly formatted files
- Easy to use, straightforward interface
- Possible to use via DI integration
Installation
Pip
pip install yumee
Poetry
Poetry is a Python dependency management and packaging tool. I actually use it for this project.
poetry add yumee
Usage
There are 2 ways to use this library : using the SongMetadataEmbedder object or via the DI.
Using SongMetadataEmbedder
The library exposes the SongMetadataEmbedder class. This class has 1 method : open_file
.
open_file
opens an audio file at a provided path and returns a BaseSongFile
to manipulate its metadata.
Once you have a BaseSongFile
, you have access to methods like embed
or extract
. embed
modifies the metadata of the SongFile according to the data provided. extract
returns the metadata that was embedded in the file.
Example 1 :
from pathlib import Path
from yumee import SongMetadataEmbedder
embedder = SongMetadataEmbedder()
path = Path("path/to/file.mp3")
with embedder.open_file(path) as song_file:
song_file.title = "New Title"
It is recommended to use 'open_file' with the 'with' statement as it will ensure that the modifications are saved as you exit the block. Otherwise, you have to make sure to call 'save' to save the modifications.
Example 2 :
from pathlib import Path
from yumee import SongMetadataEmbedder, SongMetadata
embedder = SongMetadataEmbedder()
path = Path("path/to/file.mp3")
metadata = SongMetadata(title="New Title")
song_file = embedder.open_file(path)
song_file.embed(metadata)
The 'embed' method automatically saves the modifications done. This is why I don't use 'open_file' with a 'with' statement.
Using DI
The library also exposes a BaseSongFileProvider
interface and a add_yumee
function for Taipan-DI.
In this function, SongFileProviders are registered as a Pipeline. Each SongFileProvider correspond to a specific file type and generates a BaseSongFile
. Resolve the pipeline and execute it to have a BaseSongFile
you can then manipulate.
Example :
from yumee import BaseSongFileProvider, add_yumee
from taipan_di import DependencyCollection
services = DependencyCollection()
add_yumee(services)
provider = services.build()
song_file_provider = provider.resolve(BaseSongFileProvider)
path = Path("path/to/file.mp3")
with song_file_provider.exec(path) as song_file:
...
Inspirations
This library is partially inspired by spotDL's spotify-downloader and utilises mutagen.
TODO
This library isn't stable yet and a lot of things can still be improved. If there is something you want to see added or if something does not work as you want it to, feel free to open an issue.
Here is a list of features I have in mind and will be working on :
Generate SongMetadata from a SongFile- Support Wav
- ISRC tag
- MP3 separator support
- Popularity tag (ID3)
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
File details
Details for the file yumee-0.0.3.tar.gz
.
File metadata
- Download URL: yumee-0.0.3.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1041-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f5bda58daccabc89181a625ed6122db47abcdde099ac5a0c402521d73d3db4b |
|
MD5 | 2584189c74180c95ec61df826b61f8be |
|
BLAKE2b-256 | 978dfb02c2d3a545b9ab2feee2b18236e3b19f84530187563e3e520eed356374 |
File details
Details for the file yumee-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: yumee-0.0.3-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1041-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a54910cc13844a26cab75b99d8138702b67eeeb40d24e902059c695b7774bc57 |
|
MD5 | e87539879908c1707aabc72bf7aaea49 |
|
BLAKE2b-256 | 253468893bff8f2c19ca71d57fe8de47db4a2cd2f53c4655f9542bab6ed8132b |