# Song Metadata Embedder
**Embed metadata into your music files, whatever the type**
## 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 song-metadata-embedder
```
### Poetry
[Poetry](https://python-poetry.org/) is a Python dependency management and packaging tool. I actually use it for this project.
```
poetry add song-metadata-embedder
```
## 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 : `embed`.
This method detects the type of the file you want to modify and sets the metadata accordingly.
**Example :**
```python
from pathlib import Path
from song_metadata_embedder import SongMetadataEmbedder, SongMetadata
embedder = SongMetadataEmbedder()
path = Path("path/to/file.mp3")
metadata = SongMetadata(...)
embedder.embed(path, metadata)
```
### Using DI
The library also exposes a `BaseMetadataEmbedder` interface and a `add_song_metadata_embedder` function for [Taipan-DI](https://github.com/Billuc/Taipan-DI).
In this function, the embedders are registered as a Pipeline. All you need to do is to resolve the pipeline and execute it.
**Example :**
```python
from song_metadata_embedder import BaseMetadataEmbedder, add_song_metadata_embedder, SongMetadata, EmbedMetadataCommand
from taipan_di import DependencyCollection
services = DependencyCollection()
add_song_metadata_embedder(services)
provider = services.build()
embedder = provider.resolve(BaseMetadataEmbedder)
path = Path("path/to/file.mp3")
metadata = SongMetadata(...)
command = EmbedMetadataCommand(path, metadata)
embedder.exec(command)
```
## Inspirations
This library is partially based on spotDL's [spotify-downloader](https://github.com/spotDL/spotify-downloader).
Raw data
{
"_id": null,
"home_page": "https://github.com/Billuc/song-metadata-embedder",
"name": "song-metadata-embedder",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "song metadata,song,metadata,metadata embedder,python,mp3,m4a,ogg,flac,opus",
"author": "Billuc",
"author_email": "billuc@hotmail.fr",
"download_url": "https://files.pythonhosted.org/packages/4c/35/609ebe475e74a29a22b71be61b88e476a2c070002061b24adc4ac193d702/song_metadata_embedder-0.0.1.tar.gz",
"platform": null,
"description": "# Song Metadata Embedder\n\n**Embed metadata into your music files, whatever the type**\n\n## Features\n\n- Automatic type detection based on the file extension\n - Currently supported : MP3, M4A, FLAC, OGG (Vorbis), OPUS\n- Detection of badly formatted files\n- Easy to use, straightforward interface\n- Possible to use via DI integration\n\n## Installation\n\n### Pip\n\n```\npip install song-metadata-embedder\n```\n\n### Poetry\n\n[Poetry](https://python-poetry.org/) is a Python dependency management and packaging tool. I actually use it for this project.\n\n```\npoetry add song-metadata-embedder\n```\n\n## Usage\n\nThere are 2 ways to use this library : using the SongMetadataEmbedder object or via the DI.\n\n### Using SongMetadataEmbedder\n\nThe library exposes the SongMetadataEmbedder class. This class has 1 method : `embed`.\n\nThis method detects the type of the file you want to modify and sets the metadata accordingly.\n\n**Example :**\n\n```python\nfrom pathlib import Path\nfrom song_metadata_embedder import SongMetadataEmbedder, SongMetadata\n\nembedder = SongMetadataEmbedder()\npath = Path(\"path/to/file.mp3\")\nmetadata = SongMetadata(...)\n\nembedder.embed(path, metadata)\n```\n\n### Using DI\n\nThe library also exposes a `BaseMetadataEmbedder` interface and a `add_song_metadata_embedder` function for [Taipan-DI](https://github.com/Billuc/Taipan-DI).\n\nIn this function, the embedders are registered as a Pipeline. All you need to do is to resolve the pipeline and execute it.\n\n**Example :**\n\n```python\nfrom song_metadata_embedder import BaseMetadataEmbedder, add_song_metadata_embedder, SongMetadata, EmbedMetadataCommand\nfrom taipan_di import DependencyCollection\n\nservices = DependencyCollection()\nadd_song_metadata_embedder(services)\nprovider = services.build()\n\nembedder = provider.resolve(BaseMetadataEmbedder)\npath = Path(\"path/to/file.mp3\")\nmetadata = SongMetadata(...)\ncommand = EmbedMetadataCommand(path, metadata)\n\nembedder.exec(command)\n```\n\n## Inspirations\n\nThis library is partially based on spotDL's [spotify-downloader](https://github.com/spotDL/spotify-downloader).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A generic tool to embed a song's data into a song file",
"version": "0.0.1",
"project_urls": {
"Documentation": "https://github.com/Billuc/song-metadata-embedder",
"Homepage": "https://github.com/Billuc/song-metadata-embedder",
"Repository": "https://github.com/Billuc/song-metadata-embedder"
},
"split_keywords": [
"song metadata",
"song",
"metadata",
"metadata embedder",
"python",
"mp3",
"m4a",
"ogg",
"flac",
"opus"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d00550e6115515db1990abb8d41da4610ec08acdf043b831111d1b990a23e76e",
"md5": "c04a37be5faddfc5098fd292ef189c59",
"sha256": "6f36b85afc0588e6be1558b78443fd50f4098a3d34edf02db1368448cc5e2234"
},
"downloads": -1,
"filename": "song_metadata_embedder-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c04a37be5faddfc5098fd292ef189c59",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 18252,
"upload_time": "2023-06-27T12:29:29",
"upload_time_iso_8601": "2023-06-27T12:29:29.457243Z",
"url": "https://files.pythonhosted.org/packages/d0/05/50e6115515db1990abb8d41da4610ec08acdf043b831111d1b990a23e76e/song_metadata_embedder-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4c35609ebe475e74a29a22b71be61b88e476a2c070002061b24adc4ac193d702",
"md5": "26409c51857d3c9f8e072a452b9a2def",
"sha256": "34c44a3e7281d3b1b28a8e7f1ef203fb23c1b13b8e2b98fa2634e99c425f4226"
},
"downloads": -1,
"filename": "song_metadata_embedder-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "26409c51857d3c9f8e072a452b9a2def",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 8660,
"upload_time": "2023-06-27T12:29:31",
"upload_time_iso_8601": "2023-06-27T12:29:31.083449Z",
"url": "https://files.pythonhosted.org/packages/4c/35/609ebe475e74a29a22b71be61b88e476a2c070002061b24adc4ac193d702/song_metadata_embedder-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-27 12:29:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Billuc",
"github_project": "song-metadata-embedder",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "song-metadata-embedder"
}