Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yumee-0.0.3.tar.gz (12.8 kB view hashes)

Uploaded Source

Built Distribution

yumee-0.0.3-py3-none-any.whl (22.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page