A tagging interface for multiple audio formats and metadata containers.
Project description
tagfiles
A tagging interface for multiple audio formats and metadata containers.
The supported audio codecs and containers are:
- FLAC in FLAC container
- MP3 in MP3 container
- AAC in MP4 container
- Vorbis in Ogg container
- Opus in Ogg container
Tag mappings are derived from https://picard.musicbrainz.org/docs/mappings/ .
Usage
>>> from tagfiles import TagFile, ArtistRoles
>>> from pprint import pprint
>>>
>>> tf = TagFile('/home/azuline/02. No Captain.m4a')
>>> print(tf.title)
No Captain
>>> pprint(tf.artist)
{<ArtistRoles.MAIN: 1>: ['Lane 8'],
<ArtistRoles.FEATURE: 2>: ['Poliça'],
<ArtistRoles.REMIXER: 3>: [],
<ArtistRoles.PRODUCER: 4>: [],
<ArtistRoles.COMPOSER: 5>: [''],
<ArtistRoles.CONDUCTOR: 6>: [],
<ArtistRoles.DJMIXER: 7>: []}
>>> print(tf.artist[ArtistRoles.MAIN])
['Lane 8']
>>> print(tf.date.year)
2015
>>> print(tf.date.date)
2015-01-19
>>>
>>> tf.date = '2018-01-19' # Fixing the date!
>>> print(tf.date.date)
2018-01-19
>>> print(tf.date.year)
2018
>>> tf.save()
>>>
>>> tf = TagFile('/home/azuline/music.txt')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/azuline/devel/tagfiles/tagfiles/__init__.py", line 27, in TagFile
raise UnsupportedFileType
tagfiles.errors.UnsupportedFileType
The TagFile function takes a filepath as a parameter and returns the class
which corresponds to its container. If an unsupported filetype is passed in,
the UnsupportedFileType
error is raised. Each class presents the same metadata
interface, which have the following attributes:
title: str
version: str
album: str
artist_album: List[str]
catalog_number: str
release_type: str
comment: str
date.year: int
date.date: str
track_number: str
track_total: str
disc_number: str
disc_total: str
genre: List[str]
label: str
artist = {
ArtistRoles.MAIN: List[str]
ArtistRoles.FEATURE: List[str]
ArtistRoles.REMIXER: List[str]
ArtistRoles.PRODUCER: List[str]
ArtistRoles.COMPOSER: List[str]
ArtistRoles.CONDUCTOR: List[str]
ArtistRoles.DJMIXER: List[str]
}
image_mime: str
image: bytes
Fields can be edited by setting new values to the attributes of the TagFile.
To edit the date, which is special, assign a string in the format of %Y-%m-%d
or %Y
to the date
attribute. To save the changes made to the tags, call the
save()
method.
Note: Image field is not currently editable.
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
Built Distribution
File details
Details for the file tagfiles-0.3.3.tar.gz
.
File metadata
- Download URL: tagfiles-0.3.3.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.10.7-1-default
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71e3da97b61ec2f6e2e07341ed107f38dd34514cd72542f24d7307cb60432245 |
|
MD5 | 318281b2a24e6f11c2a048fc8a759924 |
|
BLAKE2b-256 | 21d183e0cb33754bfcd034c428fe6305941d902a433b98e80646b2504b89c79c |
File details
Details for the file tagfiles-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: tagfiles-0.3.3-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.10.7-1-default
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cac070795466923ab755a6924644bb74f2e18851f3787ab314f27541bfb9384f |
|
MD5 | 24bc5a41f3fce5b0c6f3ab36302e3359 |
|
BLAKE2b-256 | 951c57ce8d8e30231eff25b51f77f21474521376052bb9045d24736ff7c85aa9 |