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 2 method : open_file
and embed
.
open_file
opens an audio file at a provided path and returns a BaseSongFile
to manipulate its metadata. embed
opens an audio file and modifies its metadata according to the data provided.
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")
embedder.embed(path, metadata)
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.
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.2.tar.gz
.
File metadata
- Download URL: yumee-0.0.2.tar.gz
- Upload date:
- Size: 11.9 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 | 96e5c686e9fdb7e8adb5c3033ec8de82e04868ece51cb68b0d3f2b8cd18905df |
|
MD5 | 5a28aa13ff020ed35e55ea4e2963612e |
|
BLAKE2b-256 | 6c52f3a955813a128aaf2107a7f80ad0cea03c659562db61f1f3ee3ac056df8c |
File details
Details for the file yumee-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: yumee-0.0.2-py3-none-any.whl
- Upload date:
- Size: 22.0 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 | 30524f75e59717a2198043720fda65a92e8aa2a33e2d1641753cedfde4e07655 |
|
MD5 | b66e34ace61fefdfb45849d8cee4e080 |
|
BLAKE2b-256 | 7821dde60c6bf9a505c8bcaa3e2137316efdd9a9852303ac4c1f487bacad6a16 |