tagfiles


Nametagfiles JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/azuline/tagfiles
SummaryA tagging interface for multiple audio formats and metadata containers.
upload_time2021-03-04 00:19:10
maintainer
docs_urlNone
authorazuline
requires_python>=3.6,<4.0
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tagfiles

[![CI](https://img.shields.io/github/workflow/status/azuline/tagfiles/CI)](https://github.com/azuline/tagfiles/actions)
[![codecov](https://img.shields.io/codecov/c/github/azuline/tagfiles?token=VF37TOZ5HJ)](https://codecov.io/gh/azuline/tagfiles)
[![Pypi](https://img.shields.io/pypi/v/tagfiles.svg)](https://pypi.python.org/pypi/tagfiles)
[![Pyversions](https://img.shields.io/pypi/pyversions/tagfiles.svg)](https://pypi.python.org/pypi/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

```python
>>> 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:

```python
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._

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/azuline/tagfiles",
    "name": "tagfiles",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "azuline",
    "author_email": "azuline@riseup.net",
    "download_url": "https://files.pythonhosted.org/packages/21/d1/83e0cb33754bfcd034c428fe6305941d902a433b98e80646b2504b89c79c/tagfiles-0.3.3.tar.gz",
    "platform": "",
    "description": "# tagfiles\n\n[![CI](https://img.shields.io/github/workflow/status/azuline/tagfiles/CI)](https://github.com/azuline/tagfiles/actions)\n[![codecov](https://img.shields.io/codecov/c/github/azuline/tagfiles?token=VF37TOZ5HJ)](https://codecov.io/gh/azuline/tagfiles)\n[![Pypi](https://img.shields.io/pypi/v/tagfiles.svg)](https://pypi.python.org/pypi/tagfiles)\n[![Pyversions](https://img.shields.io/pypi/pyversions/tagfiles.svg)](https://pypi.python.org/pypi/tagfiles)\n\nA tagging interface for multiple audio formats and metadata containers.\n\nThe supported audio codecs and containers are:\n\n- FLAC in FLAC container\n- MP3 in MP3 container\n- AAC in MP4 container\n- Vorbis in Ogg container\n- Opus in Ogg container\n\nTag mappings are derived from https://picard.musicbrainz.org/docs/mappings/ .\n\n## Usage\n\n```python\n>>> from tagfiles import TagFile, ArtistRoles\n>>> from pprint import pprint\n>>>\n>>> tf = TagFile('/home/azuline/02. No Captain.m4a')\n>>> print(tf.title)\nNo Captain\n>>> pprint(tf.artist)\n{<ArtistRoles.MAIN: 1>: ['Lane 8'],\n <ArtistRoles.FEATURE: 2>: ['Poli\u00e7a'],\n <ArtistRoles.REMIXER: 3>: [],\n <ArtistRoles.PRODUCER: 4>: [],\n <ArtistRoles.COMPOSER: 5>: [''],\n <ArtistRoles.CONDUCTOR: 6>: [],\n <ArtistRoles.DJMIXER: 7>: []}\n>>> print(tf.artist[ArtistRoles.MAIN])\n['Lane 8']\n>>> print(tf.date.year)\n2015\n>>> print(tf.date.date)\n2015-01-19\n>>>\n>>> tf.date = '2018-01-19'  # Fixing the date!\n>>> print(tf.date.date)\n2018-01-19\n>>> print(tf.date.year)\n2018\n>>> tf.save()\n>>>\n>>> tf = TagFile('/home/azuline/music.txt')\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"/home/azuline/devel/tagfiles/tagfiles/__init__.py\", line 27, in TagFile\n    raise UnsupportedFileType\ntagfiles.errors.UnsupportedFileType\n```\n\nThe TagFile function takes a filepath as a parameter and returns the class\nwhich corresponds to its container. If an unsupported filetype is passed in,\nthe `UnsupportedFileType` error is raised. Each class presents the same metadata\ninterface, which have the following attributes:\n\n```python\ntitle: str\nversion: str\nalbum: str\nartist_album: List[str]\ncatalog_number: str\nrelease_type: str\ncomment: str\ndate.year: int\ndate.date: str\ntrack_number: str\ntrack_total: str\ndisc_number: str\ndisc_total: str\ngenre: List[str]\nlabel: str\nartist = {\n  ArtistRoles.MAIN: List[str]\n  ArtistRoles.FEATURE: List[str]\n  ArtistRoles.REMIXER: List[str]\n  ArtistRoles.PRODUCER: List[str]\n  ArtistRoles.COMPOSER: List[str]\n  ArtistRoles.CONDUCTOR: List[str]\n  ArtistRoles.DJMIXER: List[str]\n}\nimage_mime: str\nimage: bytes\n```\n\nFields can be edited by setting new values to the attributes of the TagFile.\nTo edit the date, which is special, assign a string in the format of `%Y-%m-%d`\nor `%Y` to the `date` attribute. To save the changes made to the tags, call the\n`save()` method.\n\n_Note: Image field is not currently editable._\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A tagging interface for multiple audio formats and metadata containers.",
    "version": "0.3.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "24bc5a41f3fce5b0c6f3ab36302e3359",
                "sha256": "cac070795466923ab755a6924644bb74f2e18851f3787ab314f27541bfb9384f"
            },
            "downloads": -1,
            "filename": "tagfiles-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "24bc5a41f3fce5b0c6f3ab36302e3359",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 13089,
            "upload_time": "2021-03-04T00:19:09",
            "upload_time_iso_8601": "2021-03-04T00:19:09.516939Z",
            "url": "https://files.pythonhosted.org/packages/95/1c/57ce8d8e30231eff25b51f77f21474521376052bb9045d24736ff7c85aa9/tagfiles-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "318281b2a24e6f11c2a048fc8a759924",
                "sha256": "71e3da97b61ec2f6e2e07341ed107f38dd34514cd72542f24d7307cb60432245"
            },
            "downloads": -1,
            "filename": "tagfiles-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "318281b2a24e6f11c2a048fc8a759924",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 12274,
            "upload_time": "2021-03-04T00:19:10",
            "upload_time_iso_8601": "2021-03-04T00:19:10.809227Z",
            "url": "https://files.pythonhosted.org/packages/21/d1/83e0cb33754bfcd034c428fe6305941d902a433b98e80646b2504b89c79c/tagfiles-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-03-04 00:19:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "azuline",
    "error": "Could not fetch GitHub repository",
    "lcname": "tagfiles"
}
        
Elapsed time: 0.28036s